Coding to allow the app to write into a file