So why do M & M have Jesus singing the 22nd Psalm?
Well, unlike John and Luke they weren't there. Somebody told them that JC was singing the 23rd Psalm - "The Lord Is My Shepherd, etc, Though I walk through the valley of the shadow of death, etc.."
So what happened is Mark misheard and thought they said "22nd Psalm", which starts "My God, why have you forsaken me?", so he copies this out. Matthew just copied Mark.
(So in the New testament, the first sin was plagiarism!)
John and Luke were there, M&M were not.
In M & M, both thieves mock JC, when in fact only Gesmas does. Dismas asks JC to remember him when he goes up.
Possibility: after JC goes up Dismas, a believer, starts quoting Psalm 23, The Lord Is My Shepherd. This is, of course, just before they break his legs.
It is possible, after the leg breaking, Dismas THEN asks "My God, why have you forsaken me?", reciting Psalm 22.
John and Luke would have left after JC was taken down, so wouldn't be around for anything that was said by the other two. The people in the crowd, the ones who passed the info onto Mark at a later time, didn't know which was of the three JC was, just heard someone quoting Psalm 23 or 22, or both. So that's why this ends up quoted as what JC said in the M&M versions of the Gospel.
Either way, Jesus never said either one of the Psalms while up there. Obviously.