As I can see in your script you run this script on a Windows host and did a FTP connection to your GAiA appliance.
The script does not look like running on the gateway itself ( not under IPSO or GAiA ).
Maybee on your old IPSO gateway you did run a FTP server ?
Under GAiA you can connect via SCP to your gateway and receive the requested files. You have to change your script to use SCP.
Another thing to know, you can send all your messages from the gateway to the SMS (Firewall-Management) via syslog and view them in Smartconsole.