FTP and LOg file creation

Hello,

I am new to unix , and I need to create a shell sciprt which helps me FTPing file from LAn to Unix box.
These files r then processed using Perl script and put in a database.
I also need to log the entire process of all the above methods in a log file in the same shell script.
Like , all file names which got tranfered and which did not, directory that opened or falied and the databse connection failed etc instead of a generic msg and send it to the owner via email each time.

Can anyone help me guide thru the process of creating a shell script!!!

Thanks

#!/bin/ksh

dir=/dummy
v_data=emp

# 192.0.0.99 is ftp server IP address
# log file will be created as emp.log

# mget to get the files from ftp server
# mdel to delete files from ftp server

# grem all
ftp_data()
{

	echo "$1" 

	\# create log file

	exec 1>>$dir/$1.log 2>&1			

	echo "\\ncd $FGET"
	cd $FGET
	time ftp -niv 192.0.0.99 << EOF
	user dummy dummy
	cd dummy/details
	ascii
	mget $1*.txt
	ls -l 
	mdel $1*.txt
	quit

EOF

}

ftp_data "$v_data"

hi thanks for your help...........sorry cud not reply earlier!!!