rlogin from Shell script

I am logged into an AIX Unix box. From there I want to remotely login to remotely login to an HP-UX Unix box and want to execute a command that will create a file. I want to get the file to the AIX box. Can someon eplease advise how to automate that in a shell script? At the first step I want to automate the rlogin/ rsh command so that it does not ask password of the remote machine.
Can someone please help me?
asutoshch

if you are considering using the rlogin, you may choose to use "rsh" instead, as it is much easier if you are just running a script. To copy you can use "rcp".

In order to avoid the password etc. You should read up on trusted hosts. Here is something for starts

--------------------------------------
The remote host allows access only if at least one of the following conditions
is satisfied:

o The local user ID is not the root user, and the name of the local host is
listed as an equivalent host in the remote /etc/hosts.equiv file.
o If either the local user ID is the root user or the check of
/etc/hosts.equiv is unsuccessful, the remote user's home directory must
contain a $HOME/.rhosts file that lists the local host and user name.

Although you can set any permissions for the $HOME/.rhosts file, it is
recommended that the permissions of the .rhosts file be set to 600 (read and
write by owner only).
-------------------------------------

However there are some security concerns with rlogin, rsh, and rcmd but they are simplest and easiest to set up.

Good alternatives are ssh (for shell) and scp (for remote copy.) Once you get sshd up and running, scp, sftp, slogin, etc. will all work over ssh (including X tunneling over ssh - really neat - at work I use cygwin X server on my Windows laptop and tunnel X programs to my desktop)