write output to specific directory