why simulate kill all with awk when you can call killall?

Currently you are trying to kill all pids that have a.out as their name. You do this using ps, awk and kill. This can be simplified by calling 'killall a.out' which is a standard unix/osx command that takes a name and kills things that have that name.