For the FTP userid and password, you can use the .netrc file. Try doing a man on netrc (man netrc) and check it out. As for the script, search the forum for a thread on how to do this using TELNET. There is a lot of info in the board on doing this with TELNET. If you combine the same ideas for TELNET with the .netrc file, you can rock-n-roll
I leave it up-to-you to search for the thread on TELNET and scripting, if that is OK with you