Upvote:6
No, you don't need to exit the Schengen area through the country your residence permit is from. A holder of a residence permit from a Schengen country has the right to transit through the other Schengen states on his way to and from the issuing country.
Of course you also need to be allowed to enter Ghana, but that is independent of where you fly from.