Enhanced 'tee' with in-place overwriting.