kill PID running in background in for loop

Guys,

can you help me in killing the process which is running in back ground under for loop

I am not able to find the PID using ps -afx|grep <word in command I entered>

Try pgrep with -l option, and the word of command name.

$ pgrep -l vim
2599 vim
7922 vim
12516 vim
12640 vim
12686 vim