Operation to generate a unique node + relationship from existing node information extremely slow

Hi . I have a DB with around 4 million records. Max and Initial heap 5g, page cache 7g.
I am trying to generate a parent/child relationship for nodes based on some of the information (fatherName, lastName, other specific ) criteria.
If I run the following query , I added a condition on the lastName=' ABC' to limit results so it operate only on 700 records . It's very fast but it create duplicate nodes.

match(p:Person) where not (p)-[:CHILD_OF {parentRelationship:'FATHER_OF'}]-(:Person) and p.fatherName is not null and p.lastName='ABC 
merge (father:Person {firstName:p.fatherName,lastName:p.lastName,registryKadaa:p.registryKadaa,registryMouhafaza:p.registryMouhafaza,registryTown:p.registryTown,registryNumber:p.registryNumber}) on CREATE set father.constituency=p.constituency,father.name=p.fatherName+' '+p.lastName
 merge (p)-[:CHILD_OF {parentRelationship:'FATHER_OF'}]->(father)

Based on this article https:/https://neo4j.com/developer/kb/understanding-how-merge-works//neo4j.com/developer/kb/understanding-how-merge-works/
since i am creating a new relationship and new node , I should the father node so it gets created, then merge the relationship so I am tried the following query but after several hour it's not finishing.

CALL apoc.periodic.iterate("match(p:Person) where not (p)-[:CHILD_OF {parentRelationship:'FATHER_OF'}]-(:Person) and p.fatherName is not null and p.lastName='ABC' return p", "merge (father:Person {firstName:p.fatherName,lastName:p.lastName,registryKadaa:p.registryKadaa,registryMouhafaza:p.registryMouhafaza,registryTown:p.registryTown,registryNumber:p.registryNumber}) on CREATE set father.constituency=p.constituency,father.name=p.fatherName+' '+p.lastName merge (p)-[:CHILD_OF {parentRelationship:'FATHER_OF'}]->(father)",{batchSize:5000});