This is a method to write in file 