Use the XML Mapping Pane to define the Word template with Dynamics 365 entity fields.
In your Word template, click Developer > XML Mapping Pane.

The default XML schema is selected.

Select the Dynamics 365 XML schema. It will begin with “urn:microsoft-crm/document-template/”.

Important
If you have frequent accidental edits that cause Word to freeze or have performance degradation, be sure to turn off the AutoCorrect options according to the section: “A known issue and how to avoid it”.
Expand the Dynamics 365 entity, right-click the entity field, and then click Insert Content Control > Plain Text.

The Dynamics 365 entity field is added to the Word template.

Add additional entity fields, add descriptive labels and text, and format the document.
A completed template might look like this:

Some content control fields you entered likely have multiple lines of data. For example, accounts have more than one contact. To include all the data in your Word template, set the content control field to repeat.
Set content control fields to repeat
Put fields with repeating data in a table row.
Select the entire table row in the template.

In the XML Mapping Pane, right-click the relationship containing the content control fields, and then click Repeating.

When you use the Word template in Dynamics 365 to create a document, the table will populate with multiple rows of data.
When the template has the fields and formatting you want, save it and upload it into Dynamics 365.