You can do that with a static method, if everything you want can be sent to it. You could have a Utilities class with lots of static methods in. Create one with this heading
public static boolean writeToFile(
String fileName, boolean append, String[] contents)
Look in the FileWriter constructors to see what you can use the boolean append for.
Use the file name to create the Writers.
Iterate through the array and write one line at a time.
Return
true if it worked, and throw an Exception or return
false if it didn't work.
Add the exception handling, or declare it with a "throws".
But using
java.util.Formatter might be easier. There is only one problem with Formatter: as far as I can tell it always starts at the first line; I have never found a way to persuade it to append to an existing file.