write a document