Change password of linux servers remotely

Hi,
I am very bad at scripting. I need help from scripting experts...
I need to change password of around 100 linux remote servers. I have been given a script for changing the password that automates the task. however I do not understand the usage and meaning of the script, the script is an expect script. Could some one please help me understand the script and how to use it? here is the script...

#!/usr/bin/expect
# usage: runcmd <command> <password>
#
# NB: be sure to surround the command with double quotes
# if the command string is more than 1 word
#
set timeout 30
set fid [open /root/utilz/scripts/hosts r]
set contents [read -nonewline $fid]
close $fid
set cmd [lindex $argv 0]
set password [lindex $argv 1]
set newpass [lindex $argv 2]
foreach host [split $contents "\n"] {
        spawn ssh -l root $host
        expect {
                "assword:" {
                        send -- "$password\r"
                }
                "you sure you want to continue connecting" {
                        send -- "yes\r"
                        expect "assword:"
        send -- "$password\r"
                }
        }
        expect "#"
        send -- "$cmd\r"
        expect "assword:"
        send "$newpass\r"
        expect "assword:"
        send "$newpass\r"
        expect "#"
        send -- "exit\r"