title: bash - output each array element on new line
body: <p>I am trying to create a TSV file from an array that I build inside a loop. I do get the values on each line to be tab separated, but I am not able to export each element of the array on a new line. This is an example:</p>
  
  <pre><code>OUTPUT=()
  #header
  OUTPUT+=$(printf "col_1\tcol_2\tcol_3")
  
  param_1="bla"
  param_2="tra"
  param_3="meh"
  
  for i in 1 .. 3
    do
      OUTPUT+=$(printf "$param_1\t$param_2\t$param_3")
  done
  #export
  printf '%s\n' "${OUTPUT[@]}" &gt; test.tsv
  </code></pre>
  
  <p>I have also tried to put <code>\n</code> at the end of each string that I insert in the array, but it did not work. Any idea what I am doing wrong? Thank you</p>