You can use a
here document but with this way it is not possible to provide a special output document.
$ cat | nano <<-EOF
Received SIGHUP or SIGTERM
Buffer written to nano.save
This behaviour is mentioned in the man page under notes
In some cases nano will try to dump the buffer into an emergency
file. This will happen mainly if nano receives a SIGHUP or SIGTERM or
runs out of memory. It will write the buffer into a file
named nano.save if the buffer didn't have a name already, or will add a ".save" suffix to the current filename. If an emergency
file with that name already exists in the current directory, it
will add ".save" plus a number (e.g. ".save.1") to the current filename in order to make it unique. In multibuffer mode, nano will
write all the open buffers to their respective emergency files.
So i think nano is not the best choice for non interactive texting. If you only want to input multi line text to a file you can also use a
here document as well without nano.
cat > foo.txt <<-EOF
cme@itp-nb-1-prod-01 ~ $ cat foo.txt
Maybe this is what you need.