Updated the writeToCsv to write InputStream data