I have the following script that when executed, consumes memory and makes the system inaccessible. All process are halted.
You can probably drastically simplify your script by using ncftpput
and simplify it even more using scp, assuming the server at the other end is unix or linux and supports ssh/scp. first, exchange ssh-keys, then...
scp $DataFile $VMID:$$VMUser@$VMDir
And rsync over ssh is even better, especially if you repeat copies of mostly the same content or there is a chance you will expand to sending a directory full of files.