writes following to file