Why am I getting different shading on different faces when I merge the vertices?
It may be that you have inverted normals. In order to 'repair' the object, follow those steps:


Enter Edit Mode by pressing Tab.
Select every vertex in the model. You can press 1, then a (maybe even times).
Press Shift+N to recalculate normals outside, or Shift+Ctrl+N to recalculate inside.
Exit from Edit Mode by pressing Tab.


Those steps should help, but if you have messed up something other than normals, it may not help. You can also enable "Face orientation" in overlays menu in 3d Viewport to see blue/red faces indicating normals.