How to add values to child table morethan onerow

I am not able to fetch the values for second row in childtable in adoctype from another doctype . But 1st row of table is fetches the value …the process is not continue for another row…
How can i define another row???..

@SaranyaAlagar share your script so ppl can help you.

def accepted_qty(doc,method):

for d in doc.items:
	i = 0
	quality_inspection  = d.quality_inspection
	d.qty_datas0 = 0
	if quality_inspection:
		if d.qty >=0 or d.qty <=0:
			d.qty = 0
		qi_datas = frappe.db.sql("""
			select qty from `tabQuality Inspection` 
			where docstatus = 1 and  name = %s and item_code = %s """,(quality_inspection,d.item_code))

		result = 0
		for i1 in qi_datas:
			for i2 in i1:
				result_data = i2
		result += result_data								
		d.qty = result
		d +=d			

I need to copy a accepted_qty value from Quality Inspection to Purchase Receipt where Purchase Receipt Child table accept 1st row value only. the second row in purchase receipt are not fetching the value eventhough it has 2 rows of quality inspection…how can i fix the issue ?? how to fetch the second row value??