Write string to file