Hi Rajaa,
I have had an idea on how to improve MergeAll, so I just spent some hours coding a solution.
First I found that it generated the same error, but not a bad object, so I replaced rs.DuplicateEdgeCurves() with rs.DuplicateSurfaceBorder() and then it works fine.
The tool I made is fast and accurate now. It handles surfaces that are coplanar but not joinable and gives a better result on multi coplanar surfaces.
Rhinos tool tool over 3 minutes on a polysurface that my script used 6 seconds to complete, with better result:
Rhino’s tool is faster at finding if there are no coplanar surfaces, but my solution is faster at solving the result.