when you are using FileOutPutStream to perform writing in the same file the just set the true mode like

FileOutPutStream fos = new FileOutPutStream("name.txt",true);