added wrapper function to write string to file