The simple way:
First arrange for ssh's public key authentication on the remote machines so you do not need to enter passwords when invoking ssh.
The something like:
Code:
#!/bin/bash
echo >/tmp/script1 <<EOF
for i in $(seq 1 50) ; do
<process your things>
done
EOF
echo >/tmp/script2 <<EOF
for i in $(seq 51 100) ; do
<process your things>
done
EOF
scp /tmp/script1 username@host1:~/
scp /tmp/script2 username@host2:~/
ssh username@host1 /home/username/script1
ssh username@host2 /home/username/script2