How to append or write to a remote file in Linux

This week i was configuration a HP Vertica cluster environment and i needed to alter the /etc/hosts file on all of the hosts/nodes so that they can know each other. Normally i do it one by one or i use MobaxTerm where i can work on more Linux hosts in the same time running the same commands(example bellow) MobaxTerm MobaxTerm Multiple Window Work   MobaxTerm is my favorite remote terminal but still i want to make this appending process more automatic.

So let's see how can we append a line/some lines to a remote file in Linux:

Base syntax :
echo 'test, string' | ssh  user@host 'cat  /path/file'
 Example: -we will append a line to a file, and then we read from the file.
[root@primary ~]# echo 'test dummy' | ssh  root@node3 'cat   /tmp/test'
[root@primary ~]# ssh  root@node3 'cat  /tmp/test'
test dummy
So this is easy to implement in a script when you plan to build/add new host to HP Vertica Cluster(in my case). I hope this was helpful.