Consider how God uses Jeremiah to avoid both extremes. In Jeremiah 14:10b we read: [Yahweh says]:
Therefore the LORD does not accept them; now He will remember their iniquity and call their sins to account.”
What a statement of law! God will remember their iniquity and call their sins to account. Facing the sternness of the law will bring them (and us) to our knees.
We can't help but see this law preparation for the people, so that in captivity, the gospel declaration in Jeremiah 31:34 rings with even greater clarity and brings true hope to those suffering. Jeremiah points the people ahead to the new covenant, in Yahweh declares,
“... for I will forgive their iniquity, and their sin I will remember no more.”
The law remains to condemn sin. The gospel remains even brighter to remove sin from us - that is what Jesus did. That is what the people of Israel looked forward to; that is what we look back to in its fulfillment.