Hi there,
Your question is a little unclear, as you mention connecting from a *NIX box to a Linux box, but the code you included seems to be trying to telnet to a Windows box?
If both sides are indeed *NIX boxes, I'd suggest you use SSH rather than TELNET to connect, and you set up pre-shared keys, so you can log in without a password. After doing that, you can easily run a TCL script on the target machine.
If the target is a Windows box, you should be able to achieve the same, except that you need to set up an SSH server first. Look at
http://www.cygwin.com/ and
http://sourceforge.net/projects/sshwindows/ for this.