The Law of God leads us to do what is godly, righteous, and good (Romans 7:12) while the law of sin leads us in the opposite direction by staring up sinful passions in order to bear fruit unto death (Romans 7:5), so it is important to be careful not to mistake things that were said in regard to the laws of sin as being in regard to the Law of God. In Romans 6:14, Paul described the law that we are not under as being a law where sin had dominion over us, which does not describe the Law of God, but rather that is the role of the law of sin. In Romans 6:15, being under grace does not mean that we are permitted to sin, and in Romans 3:20, it is by the Law of God that we have knowledge of what sin is, so we are still under it, but are not under the law of sin. In Romans 6:16 we are slaves of the one whom we obey, either of the law of sin, which leads to death, or of obedience to the Law of God, which leads to righteousness. In Romans 6:17-18, we have been set free from the law of sin in order to become slaves of righteousness. In Romans 6:19-23, we are no longer to present ourselves as being slaves to impurity, lawlessness, and sin, but 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.You need to read with more understanding....
Romans 7 .....
4 So, my dear brothers and sisters, this is the point: You died to the power of the law when you died with Christ. And now you are united with the one who was raised from the dead. As a result, we can produce a harvest of good deeds for God. 5 When we were controlled by our old nature,[b] sinful desires were at work within us, and the law aroused these evil desires that produced a harvest of sinful deeds, resulting in death. 6 But now we have been released from the law, for we died to it and are no longer captive to its power. Now we can serve God, not in the old way of obeying the letter of the law, but in the new way of living in the Spirit.
So Romans 7:1-6 should not be interpreted in a way that rejects God's gift of eternal life. In Romans 7:1-3, at no point was the woman set free from needing to obey the Law of God, so there is nothing that leads to conclusion in verse 4 that in the same way we have been set free needing to obey the Law of God. When we died with Christ, we died to the power of the law of sin, not the Law of God. The way to be unified with God's word made flesh is not by dying to God's word, but just the opposite. Likewise, the way to bear fruit unto God is not by dying to His instructions for how to bear fruit for Him, but rather we needed to die to the law of sin that was hindering us from obeying those instructions. In Romans 7:22-23, Paul delighted in obeying the Law of God, but contrasted it with the law of sin, which held him captive, so it would be absurd to interpret Romans 7:5 as referring to the Law of God as if Paul delighted in stirring up sinful passions in order to bear fruit unto death, but rather that is the role of the law of sin, and it would likewise be absurd to interpret Romans 7:6 as if Paul delighted in being held captive to sin, but rather it is the law of sin that he described as holding him captive.