In that he saith, A new covenant, he hath made the first old. Now that which decayeth and waxeth old is ready to vanish away. Hebrew 8:13
Covenant means agreement.
Old covenant was between God and Israelites. Mediator Moses..
New covenant is between God and spiritual Israelites. Mediator Christ.
In old covenant law was written by God in stone.
In new covenant law is written by God in our hearts
For this is the covenant that I will make with the house of Israel after those days, saith the Lord; I will put my laws into their mind, and write them in their hearts: and I will be to them a God, and they shall be to me a people: heb 8.10
But this shall be the covenant that I will make with the house of Israel; After those days, saith the Lord, I will put my law in their inward parts, and write it in their hearts; and will be their God, and they shall be my people. Jeremiah 31:33
In the old covenant Israelites made covenant with God to keep his laws but they didn’t follow it.
They kept not the covenant of God, and refused to walk in his law;. PSA 78.10
The earth also is defiled under the inhabitants thereof; because they have transgressed the laws, changed the ordinance, broken the everlasting covenant. ISA 24.5
Set the trumpet to thy mouth. He shall come as an eagle against the house of the Lord, because they have transgressed my covenant, and trespassed against my law. Hos 8.1
So God has to make a new covenant with us the spiritual Israelites. This time God writes the law in our inwards parts. Law is written in our hearts. God gives a new Nature which keeps the law perfectly. We keep the law out of love not in a legalistic way.