Need help with Expect and Shell script

This is my shell script which calls an expect file, i am trying to find out server.log file sizes on various servers. But what should be correct way to do that, is there any way i can run a for loop inside the expect file which can take cat <filename> as input. I know for can be used in expect file using counters but i need the content of file as input in in for loop.
---------------------------------------------------------------------

echo "Please enter your id: "
read uid
stty -echo
echo "Enter your password: "
read pass
stty echo

#loop into different boxes
for i in server1 server2 server3 server4 server5
do

#Check for the log file/clear it if there
if [ -f ~/tmp2.log ]
then
cp /dev/null ~/tmp2.log
fi

#this passes the userid pass and the servername to the expect file
expect find_server_logs.exp $i $uid $pass

#the tmp.log file contains the path of server.log file on various paths
#can this be executed within the expect file, or is there any better way to write the expect in the shell script itself.

for x in \`cat ~/tmp.log\`
do

# ls -l will take one input at a time from the file tmp.log and show its size
ls -l $x >> ~/tmp2.log
done

echo
echo "Hostname : $i"
echo
cat ~/tmp2.log | sort \+4nr

done

________________________________________________________
#!/usr/bin/expect -f

spawn ssh [lindex $argv 1]@[lindex $argv 0] find /apps/logs/sunone -name server.log > ~/tmp.log
expect "[lindex $argv 1]@[lindex $argv 0]'s password:"
send "[lindex $argv 2]\r"
interact

*******************************

now the thing is i want the ls -l $x command to run on the various servers but fot that i have to take the inut for $x from the tmp.log file (cat tmp.log) is that possible or if there is any better way.

Looks that my question was a bit complecated. Well if anyone could give an example or resource as to how we can use a while loop in an expect file, like to read till the end of any file.

regards