I want to create a script that will automatically transfer the latest file created from one server to another. This will be run as a cron job daily. This is basically what I have. Am I on the right track? Need your help.

#!/bin/ksh
ftp servername <<+
Username=user
Password=password
cd /directory where file is located
#find the file the last file created
ll > d.file
lastfile=`grep charge d.file|awk '
{
if($16 > lf)
lf=$16
} END
get file
send to remote server
echo $lastfile

Thanks
Evette