I need an example to add related invoices of credit note or debit note in the xml
XML examples are available in the SDK.
You can download the SDK in Sandbox. After opening it, go to Data → Samples.
Example of tag:
<cac:BillingReference>
<cac:InvoiceDocumentReference>
<cbc:ID>SME00002</cbc:ID>
</cac:InvoiceDocumentReference>
</cac:BillingReference>
Example details can be found also in the data dictionary, Term ID BT-25.