Help with my weird script!

So I have this script titled "testing.sh"
#!/bin/ksh

#PROGRAM INITIALIZATION

HomeDir=/home/sap/gl/ftp
server=testftp01
userid=ftp_uatollmsgbus
password="f&p53715"
MSGLOG=${HomeDir}/msglog.txt
FTPLogTmp=${HomeDir}/testing.tmp
FTPLogFile=${HomeDir}/testing.log
FTPFILE=${HomeDir}/testing.ftp
FtpErrIni=/home/sap/SQL/ftp_error.ini
Recipient="test@test.com"
FileSize=`du -ks /home/sap/gl/ftp/${TransferFile} | cut -d/ -f1`
TransferFile="sap_exch_rate.txt"

#----------------------------
# Build FTP Script
#----------------------------

touch $FTPFILE

echo "open $\{server\}"                                    > $FTPFILE
echo "user $\{userid\} $\{password\}"                       >> $FTPFILE
echo "cd /ftp\_uatollmsgbus/OOCL/in/SAP\_BookRate_UIF"    >> $FTPFILE
echo "ascii"                                    	>> $FTPFILE
echo "prompt off"					>> $FTPFILE
echo "lcd $HomeDir"	   			     	>> $FTPFILE
echo "ls $\{TransferFile\}"				>> $FTPFILE	
echo "mput $\{TransferFile\}"				>> $FTPFILE	
echo "bye"                                    		>> $FTPFILE

#------------------------------
# FTP ERROR CHECKING FUNCTION
#------------------------------

f_CheckFtpErr()
{
tr [a-z] [A-Z] < ${FTPLogFile} > ${FTPLogTmp}

count=1
error=0
numlines=\`cat $\{FtpErrIni\} | wc -l\`

while [ $\{count\} -le $\{numlines\} ]; do
  ftp_err=\`head -$\{count\} $\{FtpErrIni\} | tail -1\` 
  if [ \`grep -c -i "$\{ftp_err\}" $\{FTPLogTmp\}\` -gt 0 -o \`grep -c -i "cannot find the file" $\{FTPLogTmp\}\` -gt 0 ]
  then
     error=\`expr $\{error\} \+ 1\`
  fi
    count=\`expr $\{count\} \+ 1\`
done

}

#--------------------------------
# FTP TRANSFER AND ERROR CHECKING
#--------------------------------

echo "Starting to FTP sap\_exch_rate.txt to testftp01" &gt;&gt; $FTPLogFile
ftp -n &lt; $FTPFILE &gt; $FTPLogFile 	
f_CheckFtpErr

#-----------------------------------------
# CHECK FOR FTP ERROR || MAIL NOTIFICATION
#-----------------------------------------

# IF THERE IS NO ERROR

if [ ${error} -eq 0 ]
then
#MAIL NOTIFICATION
echo "Dear All," > $MSGLOG
echo "" >> $MSGLOG
echo "The sap_exch_rate.txt file has been" >> $MSGLOG
echo "successfully FTP to server testftp01" >> $MSGLOG
echo "Please check." >> $MSGLOG
echo "" >> $MSGLOG
echo "Thanks." >> $MSGLOG
echo "" >> $MSGLOG
echo "" >> $MSGLOG
echo "File size of sap_exch_rate.txt is $FileSize kilobytes" >> $MSGLOG
mailx -s "FTP of sap_exch_rate.txt file to testftp01 completed successfully" $Recipient < $MSGLOG
echo "testftp01 FTP SUCCESSFUL"

# IF AN ERROR OCCURS

else
#MAIL NOTIFICATION
echo "HKCTR," > $MSGLOG
echo "" >> $MSGLOG
echo "Error has occurred while transferring" >> $MSGLOG
echo "sap_exch_rate.txt file." >> $MSGLOG
echo "Please contact the MNLSAP support for" >> $MSGLOG
echo "this week to fix the problem" >> $MSGLOG
echo "" >> $MSGLOG
echo "Thanks." >> $MSGLOG
echo "" >> $MSGLOG
echo "" >> $MSGLOG
echo "Error Log:" >> $MSGLOG
echo "" >> $MSGLOG
echo "Error: `head -3 ${FTPLogFile} | tail -1" >> $MSGLOG
echo "" >> $MSGLOG
echo "Script/Job name: testing.sh" >> $MSGLOG
mailx -s "Error in testing.sh script" $Recipient < $MSGLOG
echo "Error in testftp01 ftp"
fi

rm $FTPLogFile
rm $FTPFILE
rm $FTPLogTmp
#****************************END*OF*PROGRAM*******************************#

It basicallytransfers one text file from one server to another. My problem is this, once I run it, the file I'm looking for is successfully transferred to the other server, That's ok right? But after that, I erased my file from the home server and try to transfer it again, I get the screen that "file is not available" but an email is sent to me! saying that the file was succssfuly transferred. This is odd because the file was already deleted! how can it be transferred, but when I erase the file from the destination server, and I run the program again, I get the correct error message saying that the file is not found and an email saying that the file cannot be found.

Does anyone know how to fix this? meaning that once that file is in the destination server and I erase it from the home server and I try to run the program again, the output email should be that the file cannot be found NOT "file successfully transferred"

Are you using the ftp's return code to check for successful transfer or not ?
Use should parse the ftp log output and then decide the return status.