writing output to local dir