is there a reason you must use shell_command?
the more “built in” way is using notify.send_message to a file notify entity.
take a look at this: