How to select two specified paths from three or more paths to overlap into one path

How to select two specified paths from three or more paths to overlap into one path

Do you like to do that manually or in a script?