wrote a test case to write the contents into file