I'm not sure if this is your problem, but a | pipe makes the processes following it run as a subshell. You can avoid this, and the need for the external cat command, by using a simple file redirection.
while read line; do
ssh "$line" ps ux
Also, please use [code][/code] tags around your code, to preserve formatting and to improve readability.