As Paul’s preaching the gospel of justification by faith, not works of the law, he expects his hearers to ask questions like “why did God give the law then?” (v19)
If a preacher never has anyone ask him questions like that – if no one ever listens to his sermons and wonders “if we’re saved by faith in Christ, not by our obedience, what is the law for?” – then he probably hasn’t preached the gospel properly.
And in v21, Paul expects people will be thinking “doesn’t the law contradict the promises of God that you’re talking about? If God’s given a list of rules and the punishments that apply for people who break those rules, doesn’t that contradict his promise of an inheritance for those of faith?”
The answer is: not if you understand what the law was actually given for in the first place. So Paul clarifies what the law was given for, and what it’s not for.