You probably should be using rsync for this, as it would reduce everything you’re trying to do (as i understand it) to a single UNIX command. rsync is a UNIX tool which can connect to a remote machine, transfer files, and compress the data as it’s transported. It’s actually capable of much more than that, and can be used to bi-directionally sync complete files systems. You do need rsync on both boxes, which is generally the case for UNIX like OS’s.
See man rsync for details.
I’d recommend you use SSH for connections, if possible, as it’ll protect your data and passwords. FTP is very insecure. rsync supports SSH.