No part of your JSF code should ever handle File I/O directly.
You should use a helper/business class to do this for you and then call that class' method(s) from your backing bean (controller).
Look into writing a text file with
Java and forget about JSF. Then, take the code you've written and call it from your backing bean. We have an
IO And Streams forum in case you need to ask specific questions about IO.