Saint Ambrose (c. 340 – 4 April 397) in his book, Understanding the Law and Grace in Christ, details the purpose of God's law in our lives and the purpose of the gospel. Below is an excerpt.
The natural law
There is a natural law written in our hearts [as] the apostle [Paul] … teaches us when he writes that, for the most part, “the Gentiles, which do not have the Law, do by nature the things contained in the Law, and, though they have not read the Law, still have the works of the Law written in their hearts” [Romans 2:14–15].
Adam broke this law … [and] incurred guilt and through arrogance fell into transgression. Had he not thus violated his allegiance, but been obedient to the commands of heaven, he would have preserved to his posterity the prerogative of nature and the innocence that he possessed at his birth.
Reasons for the law
Therefore, as by [Adam’s] disobedience the authority of the law of nature was corrupted and blotted out, the written law was found necessary.
The [written] law, then, was published, first, to take away all excuse, lest man should say, “I did not know sin because I received no rule what to avoid.”
And next, that “all the world might become guilty before God” by the recognition of sin [Romans 3:19].
Now the world becomes guilty before God by the law, in that all are made liable to its prescripts, but no man is justified by its works. By the law comes the knowledge of sin, but not the remission of guilt.
The gospel overpowers the law
But, when the Lord Jesus came, he forgave all men that sin which none could escape and “blotted out the handwriting against us” by the shedding of his own blood [Colossians 2:14].
This, then, is the apostle’s meaning: sin abounded by the law, but grace abounded by Jesus; for after the whole world became guilty, he took away the sin of the whole world, as John bore witness, saying: “Behold the Lamb of God, who takes away the sin of the world” [John 1:29].
God deserves our praise
Therefore let no one glory in works, for by his works no man shall be justified, for he who is just has a free gift, for he is justified by the Bath [of Baptism]. It is faith, then, which delivers by the blood of Christ, for “blessed is the man to whom sin is remitted and pardon granted” [Psalm 32:1].
Source: Understanding the Law and Grace in Christ by Ambrose of Milan. Aurelius Ambrosius, better known in English as Saint Ambrose, was a bishop of Milan who became one of the most influential ecclesiastical figures of the 4th century. He is notable for his influence on St. Augustine.