God gave His law in the Old Testament to show us what we are like.
According to the Apostle Paul, Godâ€™s law did three things for us (Romans 3:19-20). First, it left us without any excuse. God said do and we didnâ€™t and God said donâ€™t and we did. Second, it left us guilty before God; that is, obvious lawbreakers whoâ€™ve come miserably short of Godâ€™s standard of sinless perfection. Finally, it brought to us the knowledge of sin; that is, the knowledge that there is something horribly wrong with us, because no matter how hard we try to do right we keep doing wrong.
Notice, Paul taught that the Law brought to us the knowledge of sin, not sins. Our real problem is not our sins, what we do, but our sin, what we are. Weâ€™re not sinners because we sin. We sin because weâ€™re sinners. A thief is not a thief because he steals, but he steals because he is a thief. A liar is not a liar because he lies, but he lies because he is a liar.
By bringing to us the knowledge of sin, Godâ€™s Law proved to us the impossibility of ever making ourselves acceptable to God by our obedience to his Law. Therefore, Godâ€™s Law prepared us for the coming of Godâ€™s Son, by proving to us our need of a Savior.