Each recursive call to your clone function takes an original node and returns its copy. Inside the call, you create a new node, store it in the map, then loop through the original's neighbors. For each neighbor, you call clone recursively. The returned copy gets added to your new node's neighbor list.
When recursion hits a node that is already in the map, it returns the existing copy right away. This is how the algorithm terminates. Every node gets cloned exactly once, and every edge gets recreated exactly once.