Expect script issue

HI Al,
I have written the following expect script:

#!/bin/ksh
#!/usr/local/bin/expect--
##echo "PLease enter the server name"
##read host
echo "please enter the instance"
read instance
set ##password to be entered right before the script is run##
##/usr/local/bin/expect<<-EOF
cat serverlist.txt | while {read host};
do
/usr/local/bin/expect<<-EOF
spawn ssh -p 2222 $instance@$host
sleep 1
expect "*Password:*"
sleep 1
send "$1\r"
expect "*/export/home/a61359>#*"
send "/usr/local/bin/top -d 2 >> tempfile.txt\r"
expect "*/export/home/a61359>#*"
send "uuencode tempfile.txt tempfile.txt | mailx -s '$host' myemail@mycompany.com\r"
sleep 1
expect "*/export/home/a61359>#*"
sleep 1
send "rm tempfile.txt\r"
sleep 1
expect "*/export/home/a61359>#*"
sleep 1
send "exit\r"
expect eof
done

This script gives me the error

./ssh.sh[9]: syntax error at line 11 : `<<' unmatched

when I run it. serverlist.txt is a list of servers in teh same directory as the script
How ever when I run the script by commenting out the while loop and taking the server and the instance name from the user it works.
I have already checked the spaces around the /usr/local/bin/expect<<-EOF and the issue persists.
few noteworthy things.
I have not been able to run expect without having the "/usr/local/bin/expect<<EOF" option.
Could somebody please suggest if I am making a syntax error in the while loop or anything else...
Thanks in advance

you can't mix both expect & ksh in same script. write two 2 scripts one reads the hostfile and sends instance,host, password to expect scripts. which does your job. here is the sample. this might not work as i did try to explain. good luck let me know how it goes.

cat yourscript.sh

#!/bin/ksh
echo "please enter the instance"
read instance
set ##password to be entered right before the script is run##
##/usr/local/bin/expect<<-EOF
cat serverlist.txt | while read host;
do
/usr/lib/some_expect.sh $instance $host $password
done

cat /usr/lib/some_expect.sh

#!/usr/local/bin/expect--
spawn ssh -p 2222 $1@$2 $3 # $1 -- Instance $2-- Host $3-- Password
sleep 1
expect "*Password:"
sleep 1
send "$1\r"
expect "*/export/home/a61359>#
"
send "/usr/local/bin/top -d 2 >> tempfile.txt\r"
expect "*/export/home/a61359>#"
send "uuencode tempfile.txt tempfile.txt | mailx -s '$host' myemail@mycompany.com\r"
sleep 1
expect "*/export/home/a61359>#
"
sleep 1
send "rm tempfile.txt\r"
sleep 1
expect "*/export/home/a61359>#*"
sleep 1
send "exit\r"
expect eof

Thanks sooo much gopidesaboyina...
This helps a lot....
God Bless