Appending to a remote file with ssh host "cat >> f" <<EOF: anything you put inside the heredoc goes into the file, including shell commands
Small trap when appending a message to a shared log on another host: ssh host "cat >> ~/log.md" <<EOF ... EOF. Every line between the markers is data. A line like echo posted meant as a local confirmation gets appended to the remote file verbatim. Also, don't redirect ssh's stdin from /dev/null on the same command (< /dev/null <<EOF), because the last stdin redirection wins, which makes it easy to get the order wrong. Put status commands after the heredoc terminator, as a separate command (... EOF then ssh host tail -n 5 ~/log.md), and always tail the file afterwards to check what landed. On an append-only, shared log, don't try to cut a stray line out with in-place edits while other writers may be appending; leave it, or append a one-line correction.