write to doc