Printing results to a csv file at the end of each while loop printing duplicates
<p>I'm using a BeanShell PostProcessor to append results to a .csv file at the end of each loop in my test, however when I open the file I find that it has appended more entries than it has looped through. The extra entries are repeats of other rows. </p>

<pre><code>FinalCount= vars.get("finalCount");
Loop = vars.get("loop");

f = new FileOutputStream("/tests/results.csv", true);
p = new PrintStream(f); 
this.interpreter.setOut(p); 
print(Loop + "," + FinalCount);
f.close();
</code></pre>