in reply to SSH OUTPUT WITHOUT ENDING OF COMMAND

This is most likely a buffering issue.

Try adding the -t option to the ssh call. This forces pseudo tty allocation, which in turn might cause the script on the other end to act line-buffered (as opposed to block-buffered, which is the default for non-interactive transfers).

For example

$ ssh -t localhost 'perl -E "say && sleep 1 for 1..10"'

outputs 1..10 individually in one second intervals, while without the -t, you get all lines in one chunk when the 10 secs are over.