(defun new-note ()
(interactive)
(insert "----------------\n")
(insert (shell-command-to-string "echo -n $(date \"+%Y-%m-%d %T\")"))
(insert "\n"))
(global-set-key (kbd "C-M-n") #'new-note)
And to invoke it from the shell: emacs --function new-note --file notes.txt
If somebody knows a better or more elegant way to do this, please tell me!