write document