Try next cmdline, script caller set the output, script only read from stdin and write to stdout.
Code:
| $HOME/myscript.sh > $HOME/my.log
And myscript.sh, including also how to ex. to set uppercase without external command (ex. tr). Also no need to tell input, if it is stdin.
Code:
#!/usr/bin/ksh
typeset -u input
while read input
do
print "$input"
# if you like to add line to some file, then
# print some >> somefile
# single > is overwrite = file include only the lastline
done
But if you like to put all while output to file then >> must be after done = end of while cmd.
Code:
while read line
do
print some
done >> outfile
# or ex. done | outpipecmd > outfile
# all output, which are done between do-done goto outfile
Script are more generic, if script read from stdin and write to sdtout. Caller make define for input and output. Whole idea of *nix systems/commands - io-redirection and pipes.