Child table data to another parent doctype data

Hello,
In Supplier doctype, there is a way to create contacts and address from Contacts and Address form in CRM. But I want to create contacts and address from supplier by a custom child table. I want to insert data into child table and with these data, contacts and address will create. I want to update data from this child table too. As this data created on save, so I want to create in from backend.

Here is the code as far I go:

    def after_insert(self):
        self.save_contact()

def save_contact(self):
        for row in self.get("address_and_contacts"):
            doc = frappe.new_doc('Contact')
            doc.first_name = str(row.first_name)
            doc.append("email_ids",
                       {
                            "email_id": row.email_id,
                            "is_primary": 1
                       }),
            doc.append("phone_nos",
                       {
                            "phone": row.phone,
                            "is_primary_phone": 1
                       }),
            doc.append("links",
                       {
                            "link_doctype": "Supplier",
                            "link_name": self.name,
                       }),
            doc.save()

How to update from child table? Is this ok?