title: How to echo $variable into text file within a loop
body: <p>I am writing a shell script in which I have a loop. As the loop goes through different values get assigned to the variable <code>i</code> . I want to echo all the values that get <code>i</code> gets assigned each time the loop runs, into a text file. </p>
  
  <p>What I am doing is at the moment is:</p>
  
  <pre><code>echo " $i " &gt; fail
  </code></pre>
  
  <p>but that only gets me the last value that was assigned to <code>i</code> . </p>