It is not true that the law gives us "knowledge of what sin is".
So then are you deny the truth of Romans 3:20? How can the Law of Moses teach us that we are sinners in need of a Savior if it doesn't teach us what sin is?
Eating from the tree of the knowledge of good and evil did that. On the contrary, the law teaches those who read it that God sees their sins, does not like it, has declared them guilty, and has condemned them to eternal death because of it. That is why it is said, "the letter kills" (2 Cor 3:6).
No, Adam and Eve were at a crossroads between eternal life and morality before they had eaten from either tree, where eating from the Tree of Knowledge caused them to become mortal while eating from the Tree of Life would have caused them to have eternal life. In Romans 10:5-8, Paul referred to Deuteronomy 30 as the word of faith that we proclaim in regard to the righteousness that is by faith proclaiming that the Law of Moses is not too difficult for us to obey and that obedience to it brings life and a blessing while disobedience to it brings death and a curse, so choose life! So the Israelites were at the same crossroads between life and death and the Law of Moses gives us both options.
When we don't see anything wrong with doing what God has commanded against or with not doing what God has commanded, then we have a choice between whether we are going to learn on our own understanding of right and wrong by doing what is right in our own eyes (Tree of Knowledge) or whether we are going to trust in God with all of our heart to correctly divide between right and wrong through obeying His law in all of our ways and He will make our way straight (Tree of Life)(Proverbs 3:1-7, 18). Likewise in Revelation 22:14, those who kept God's commandments are given the right to eat from the Tree of Life.
In Deuteronomy 32:46-47, the Law of Moses is our very life. In Leviticus 18:5, those who obey the Law of Moses will live by it. In Proverbs 6:23, for the commandment is a lamp and the teaching a light, and the reproofs of discipline are the way of life. In Luke 10:25-28, Jesus affirmed that the way to inherit eternal life is by obeying the greatest two commandments of the Law of Moses. In Matthew 19:17, Jesus said that the way to enter eternal life is by obeying God's commandments. In Hebrews 5:9, Jesus has become a source of eternal salvation for those who obey him. In Romans 2:6-7, those who persist in doing good will be given eternal life. In Romans 6:19-23, we are no longer to present ourselves as slaves to lawlessness, impurity, and sin, but are now to present ourselves as slaves to God and to righteousness leading to sanctification, and the goal of sanctification is eternal life in Christ, which is the gift of God, so being a doer of the Law of Moses is God's gift of eternal life.
In Acts 5:32, the Spirit has been given to those who obey God. In John 16:13, the Spirit has the role of leading us in truth, in Ezekiel 36:26-27, the Spirit has the role of leading us to obey the Law of Moses, and in Psalm 119:142, the Law of Moses is truth. In John 16:8, the Spirit has the role of convicting us of sin, and in Romans 3:20, it is by the Law of Moses that we have knowledge of what sin is. In Romans 8:4-7, Paul contrasted those who walk in the Spirit with those who have minds set on the flesh who are enemies of God who refuse to submit to the Law of Moses. In Galatians 5:16-23, Paul contrasted the desires of the Spirit with the desires of the flesh and everything that he listed as works of the flesh that are against the Spirit are also against the Law of Moses while all of the fruits of the Spirit are character traits of God that the Law of Moses was given in order to teach us how to embody. In Romans 2:25-29, the way to recognize that a Gentile has a circumcised heart is by observing their obedience to the Law of Moses and circumcision of the heart is a matter of the Spirit, which is in contrast with Acts 7:51-53, where those who have uncircumcised heart resist the Spirit and do not obey the Law of Moses.
The New Covenant involves God putting the Law of Moses in our minds and writing it on our hearts (Jeremiah 31:33) and God taking away our hearts of stone, giving us hearts of flesh, and sending His Spirit to lead us in obedience to the Law of Moses. So the Bible repeatedly states that the New Covenant involves following the Law of Moses, that the Spirit has the role of leading us to obey it, and that obedience to it brings life, so 2 Corinthians 3:6 needs to be understood in a way that is in accordance with the rest of the Bible rather than away that overturns it. If following the letter referred to correctly following God's instructions and that leads to death, then that would mean that God would be misleading us and should not be trusted, but rather there must be something deficient about following the letter that causes it to lead to death rather than life.
The law, therefore, is our teacher. It teaches us we are sinners in need of a Savior. And when we find the Savior, we don't need the teacher any more. That is why it is said, "24 Therefore the law was our tutor to bring us to Christ, that we might be justified by faith. 25 But after faith has come, we are no longer under a tutor." (Gal 3:24–25)
In Exodus 33:13, Mosses wanted Go to be gracious to him by teaching him to walk in His way that he and Israel might know Him, and in Matthew 7:23, Jesus said that he would tell those who are workers of lawlessness to depart from him because he never knew them, so the goal of the Law of Moses is to graciously teach us how to know God and Jesus by walking in His way, which again is His gift of eternal life (John 17:3).
Someone who disregarded everything that their teacher taught them after they reached the point where they no longer needed a teacher would be missing the whole point of a teacher. The Law of Moses leads us to Christ because it was given in order to teach us how to know Him, or in other words, how to have an intimate relationship with him, but it does not lead us to him so that we can then reject everything that he taught and go back to being workers of lawlessness. In Acts 3:25-26, Jesus was sent as the promised seed to bless us by turning us from our wickedness, not in order to curse us by freeing us to become doers of what the Law oft Moses reveals to be wickedness. Jesus saves us from our sin (Matthew 1:21) it is by the Law of Moses that we have knowledge of what sin is, so Jesus graciously teaching us to be doer of it is intrinsically the way that he is giving us his gift of saving us from not being doers of it. In other words, the Law of Moses does not just teach us of our need for a Savior but also teaches us the way that he is saving us.