You need to use Select Object: Filter Selection -> Filter Ray. It's a filter ray so it only affects the stuff that were previously selected. To use it:
Place a Select Object -> Create Selection -> Entity By Condition: If Entity Is Mob. That selects all mobs. Now, place a Select Object -> Filter Selection -> Filter Ray, in its first slot, place a variable (preferably a LOCAL one), this will give us the hit location (so we can summon a particle at that location), let's call it HitLocation for now. in the 2nd slot put a Game Value -> Location Values -> Eye Location of the default player so the raycast starts from your eye. In the 3rd slot, put a number that will represent the max distance in blocks. in the 4th slot put a number that will indicate the width, putting larger numbers will allow the player to hit the mobs easier. And lastly in the 5th slot, put a number that will indicate how many mobs it pierces (and damages), a Number 1 would only damage 1 entity.
Now your Selection Target is the mob(s) that you hit, you can place an Entity Action: Damage, Shift-Right click the sign of it and click Selection (so you change the target of the code block), and put a number of your choice in the chest that indicates the damage (in half hearts, so a number 2 = 1 heart). And you can place a Player Action: Particle and spawn particles with the HitLocation variable as the location parameter.