Keeping from pulling extra mobs

How do you keep from pulling extra unintended mobs. I’m having a problem where if I run the macro just a bit to long it will pull the next group

if it has a line with target enemy in it remove that line
*

My stuff works where if i hit the button again it will cancel the action so I just tap the key again when the mob the group is killing is very low and I have gotten pretty good at timing it. It took some practice but I do it pretty well. I play with a Razer Orbweaver basically. It just repeats button 1 until I hit a button again etc. So I put the hunter DPS macro on button 1 and it plays it out, meanwhile I use the regular keyboard to move around and dodge mechanics on raids. I use my mouse keys to steer and i have a few buttons on my mouse that let me hit some hotkeys I want to use so that I don’t interrupt the Macro going. When I’m on a long raid boss fight I play that style. When I do a dungeon or something with short fights I just keep my hand on the Razer and control it myself.