i want to add total of amount in frappe doc in print format

Item Code
Item Name
Qty
Rate
Selling Price

{%- for row in doc.items -%}
{%
set rate=frappe.db.get_value(“Item Price”,{“item_code”:row.item_code,”price_list”:doc.price_list,”selling”:1},”price_list_rate”)
%}

{{row.item_code}}
{{row.item_name}}
{{row.qty}}
{{rate}}
{{'%0.3f'| format(rate*row.qty|float)}}

{%- endfor -%}