Error in execting ftp script

Please find the below script:

#!/bin/ksh
host='gskprod.xyz.com'
USER='gsk'
PASSWORD='ahdpw1'
remote_dir='gsk_ds'

ftp -n "${host}"
user $USER $PASSWORD
binary
cd $remote_dir
mget *.txt
mdelete *.txt
bye

It does not recognizes userid and password. It executes only upto ftp -m "${host}" line. Then i shows the ftp prompt. It is not executing the following line.

I have to run all the above statements as a single script in FTP. Please let me know what i need change to execute as a single script.

TIA.

Bye.

ftp -ni "${host}" << EOF
user $USER $PASSWORD
binary
cd $remote_dir
mget *.txt
mdelete *.txt
bye
EOF

Script is executing fine. Thanks a lot for the help.

which option i should include in order to log all the ftp activities in a log file.

TIA.

ftp -niv "${host}" << EOF >x.log
user $USER $PASSWORD
binary
cd $remote_dir
mget *.txt
mdelete *.txt
bye
EOF