@Tito said:

server is a plain FTP

Sorry, of course you have to replace sftp process by ftp process, like in your script, sorry one more time