Writing stuff to output file