Maybe use the editor of your choice and write a shell script, ie. write it into a file, like this example with the editor "vi":
(press i to insert text)
$> vi myscript.ksh
#!/bin/ksh
echo this is line 2
exit 0
(press : then write wq and hit ENTER)
$> chmod 750 myscript.ksh
$> ./myscript.ksh
this is line 2
vi might seem difficult at first but after some weeks of use you will accidentally use things like :wq in editors like Open Office Writer accidentally
There are plenty of references on vi commands/shortcuts on the web.