Need help in FTP script to archive

Hi Guys,

I am unable to archive the FTP files from FTP source path to FTP archive path.Currently i am running this script from the Local server. Can someone help me here.
Code:

#!/bin/ksh
set -x
HOST='xxxx'
USER='xxxx'
PASSWD='xxxx'
PORTNO='9999'

FILE_NAME=$1
FTP_SRC_PATH=$2
FTP_ARC_PATH=$3
CURR_PATH=`pwd`
#CURR_PATH='/Product/Asset/Source'

ftp -n $HOST $PORTNO <<ENDfilelst
cd $FTP_SRC_PATH
quote USER $USER
quote PASS $PASSWD
bin
prompt
lcd $CURR_PATH
cd $FTP_SRC_PATH
ls $FILE_NAME archivefilelist.txt
quit
ENDfilelst
cat archivefilelist.txt
cat archivefilelist.txt | rev | cut -d' ' -f1 | rev > tempfile
mv tempfile archivefilelist.txt

while read line
do
ftp -n $HOST $PORTNO <<ENDfilelst
quote USER $USER
quote PASS $PASSWD
bin
prompt
lcd $CURR_PATH
rename $FTP_SRC_PATH/$line $FTP_ARC_PATH/$line
quit
ENDfilelst
done < archivefilelist.txt

I am getting below error

+ ftp -n wmx-mft-test.avnet.com 8121
Command not recognized or allowed.
Interactive mode off.
Local directory now /var/local/ei/etl/Scripts
+ cat archivefilelist.txt
+ cat archivefilelist.txt
+ rev
+ cut '-d ' -f1
+ rev
+ mv tempfile archivefilelist.txt
+ read line
+ rm archivefilelist.txt

Try moving the cd $FTP_SRC_PATH line after the quote lines in the ftp script.

Try moving the cd $FTP_SRC_PATH line after the
quote lines in the ftp script.

I am still facing the same error.Can someone help me here

Output Error:

+ FTP_SRC_PATH=/Product/Asset/Source
+ FTP_ARC_PATH=/Product/Archive
++ pwd
+ CURR_PATH=/var/local/ei/etl/Scripts
+ ftp -n wmx-mft-test.avnet.com 8121
?Invalid command
Interactive mode off.
Local directory now /var/local/ei/etl/Scripts
+ cat archivefilelist.txt
+ cat archivefilelist.txt
+ rev
+ cut '-d ' -f1
+ rev
+ mv tempfile archivefilelist.txt
+ read line
+ rm archivefilelist.txt