You are looking in the wrong place for performance enhancements.
BufferedWriter is the correct tool for the job, however why are you opening it each time round the 'while' loop?
Why are you...