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