Display all items names in print format

I am facing a problem regarding how I will display all items in receipt or payment entry print.

{% for items in doc.references %}

{%	set result=frappe.db.get_value("Sales Invoice Item",filters={'parent':items.reference_name},fieldname=['rate','qty','amount','item_name'],as_dict=true) %}

Received a sum of ₹{{ items.allocated_amount }} ({{ frappe.utils.money_in_words(items.allocated_amount ) }}), from {{ doc.party_name }} {{ frappe.db.get_value("Address", doc.shipping_address_name, "address_line1") }}, {{ frappe.db.get_value("Address", doc.shipping_address_name, "city") }},  {{ frappe.db.get_value("Address", doc.shipping_address_name, "pincode") }}, {{ frappe.db.get_value("Address", doc.shipping_address_name, "state") }}, {{ frappe.db.get_value("Address", doc.shipping_address_name, "country") }} by cash on account of {{ result.item_name }}.
{% endfor %}

<br>
<br>
<br>
<strong style="float: right;">Cashier</strong>

This is the code.
I want o display all item names which were in sales invoice. but it is not picking all names.
Any help will be appreciated.

Thankyou