I guess (I have tried with my IP but there was some prob. while connecting but this worked for FTP), you will have to use the block(here I used ENDSCRIPT) for your script. like ...
ssh 10.191.21.2 <<ENDSCRIPT
more /.rhosts | grep machine_1 >tmpfile <<
if [ -s "tmpfile" ]
then
echo "" >/dev/null
else
echo "10.191.21.2 root" >>/.rhosts
fi
rm tmpfile
ENDSCRIPT
..try this way. might work but not sure
