How to append using tee command

The -a modifier is for ‘append’, or add to the end. Without -a the tee command overwrites the file

From man tee:

   Copy standard input to each FILE, and also to standard output.   -a, --append          append to the given FILEs, do not overwrite

Example:

1. The content of the run_script.sh file

curl -X GET "localhost:9200" | tee log.txt
echo "helelelelelelelele" | tee -a log.txt
curl -X GET "localhost:9200" | tee -a log.txt

2. execute is:

$ ./run_script.sh 

3. Content of log.txt

{
"name" : "SHUMrBf",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "beIL54B6SWSS1lb-r9mz9Q",
"version" : {
"number" : "6.5.4",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "d2ef93d",
"build_date" : "2018-12-17T21:17:40.758843Z",
"build_snapshot" : false,
"lucene_version" : "7.5.0",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}
helelelelelelelele
{
"name" : "SHUMrBf",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "beIL54B6SWSS1lb-r9mz9Q",
"version" : {
"number" : "6.5.4",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "d2ef93d",
"build_date" : "2018-12-17T21:17:40.758843Z",
"build_snapshot" : false,
"lucene_version" : "7.5.0",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}