It appears you're trying to restrict the output to be for the PID of tomcat. To do that you need to use the "-a" ("and") flag:
Code:
/usr/sbin/lsof -t -i TCP:8009 -a -p $(cat /var/run/$TOMCAT.pid)
Also you don't really need to provide "TCP" or "localhost" if all you're interested in is the port - you can just put ":8009":
Code:
/usr/sbin/lsof -t -i :8009 -a -p $(cat /var/run/$TOMCAT.pid)
Finally you're doing a while loop - this means as long as the condition is true it will repeat the loop. It may be what you're thinking is a "hang" is in fact just an infinite loop. Since I don't know the purpose of your script I can't tell if you intended such a loop.
Also the output of the command would simply be the pid of the process. I'm assuming your intent is to verify that the port is open and associated with the Tomcat process. If you only want to know the PID it is already predetermined in your /var/run/$TOMCAT.pid file.