write document.