This has two big problems. One is the empty catch block - if anything goes wrong, this is hiding information from you. You need to make sure that if an error occurs, you get some information about it. The simplest way to do this is to print a stack trace:
Later you can learn how to use a logger like log4j. But this is good enough to start.
The second problem, probably the one that's preventing the file frombeing written correctly, is that you never close the writer. It's probably sufficient to just add buffin.close() after the write. To do it right, though, you really should get in the habit of putting the close in a finally block: