This may or may not help with your problem, but: when using ssh as stand-in for the classical rexec you principally should add a -o BatchMode=yes to the call. Otherwise, when the exchanged key pair gets invalid somehow, you might end with a ssh-process asking for your password (and halting the surrounding script).
What might also be the problem here is that the processes you call in "execfile" (which i would give a full path in your place, but that just as an aside) grab a terminal. Try adding "-n" to the ssh-call (see the man page for ssh for details).
Thanks for your response, i haven't made my ssh connection password less
i want script to prompt for the password so i think i cant use -n option and with -o option i am not able to connect to remote host.
i want script to prompt for the password so i think i cant use -n option
These two things have nothing to do with each other. Please read the man page for ssh: -n controls the allocation/non-allocation of a pseudo-terminal (stdin/stdout for the processes called within the ssh-session).
Regarding the "-o": i thought your ssh-line was part of a script and surrounded by other commands. My bad.