Order Dictionary(Larger) Recursion

I’m Not able to understand as to why i’m failing the 1st Test Case.
Previously I was able to Pass it but the output wasn’t sorted so after altering the code i’m failing the first case.