Write values while runnig program
<p>i want to write some data to a .txt file.</p>

<pre><code>     public void writeToFile(String filename) {

    try {

        //Construct the BufferedWriter object
        bufferedWriter = new BufferedWriter(new FileWriter(filename));

        //Start writing to the output stream
        bufferedWriter.write("first value : " + firstValue);
        bufferedWriter.newLine();

    } catch (FileNotFoundException ex) {
        ex.printStackTrace();
    } catch (IOException ex) {
        ex.printStackTrace();
    } finally {
        //Close the BufferedWriter
        try {

           if (bufferedWriter != null) {
               bufferedWriter.flush();
                bufferedWriter.close();
            }
        } catch (IOException ex) {
           ex.printStackTrace();
        }
    }
}
</code></pre>

<p>i use this code, buth the problem is, that it overwrites the first line constantly (i think).
Does anyone have a idea how i can fix this?
i read everey 50ms a value from the serial port, and wan't to write this. (every value on a separate line)</p>

<p>it should write the values until i close the progam.</p>

<p>best regards</p>
