Only thing which u needa do is just open the your "data.html" file in append
mode in File2.java. Then it'll just append the String to the file.
just replace
fos = new FileOutputStream(FileName ); in File2.java with
fos = new FileOutputStream(FileName,true );
which sets append value to true which is false by default.