How can I create a new doctype while saving child table from another doctype

How can I create a new doctype while saving child table from another doctype