A process don't have any name. It has a (positive) unique number, called its pid (process id).
Almost all processes are started -from their parent process- by the fork system call documented in the fork(2) man page (sometimes, vfork(2) might be used). A forked process is nearly identical to its parent (it executes the same binary). To execute a new program, the execve(2) syscall is used inside some process.
However, a process does execute some program, which does have a name (since it exists in the filesystem). You can find much more about processes thru the proc(5) pseudo-file system. Of course, several processes could execute the same program. You could try
ls -l /proc/self/ to list the pseudofiles related to your process (the one executing that
ls command). You might have fun trying
cat /proc/self/maps. And
/proc/1234/ tells you about process of pid 1234.
pidof utilities are using
I suggest you to read a good book on advanced unix programming -on paper- and on advanced Linux programming -on the web-; Read also about syscalls(2), also the wikipage on syscalls.
Your script is not right in using directly
kill -9. It should try first
kill -TERM then
kill -QUIT (to let the program terminates nicely, e.g. cleaning temporary files, etc...) and only at last
kill -KILL (i.e.
kill -9). You could read the kill(2) man page (and also signal(7) man page).