write output to file (uses absolute paths)