buffer output to file