telnet shell-script in Automator
Incorporating Automator might be unnecessary for what you're trying to achieve. Perhaps it would be more suitable to just write a bash shell script. If you've never written a bash shell script before, it's easy to get started. You can simply type out the commands exactly how you've already demonstrated, but into some kind of text editor or notepad software, and save it with an .sh extension on the end.  

When I first started learning about this stuff years ago I found nano to be a quick and easy text editor for learning and writing new material. If you want to give it a try you can start by just typing nano in the terminal.  

If necessary, you can grant executive permission with:  

chmod +x ./example.sh


Let me know if this helps put you on the right track or not. If not, we can just try something else. Also, if you want/need you can reply here or contact me privately via chat.