There was no way for the law to take away sin. It was simply a list of rules to live by to avoid sinning, but it could not take away sin and its power. Why would God give a list of rules instead of sending Jesus from the very beginning?
Man has struggled with sin since the beginning of time. Over and over again man chooses sin and its pleasures instead of God and His perfection. Perhaps, the law was given to expose the depth of sin and the need for something more. In the Old Testament, the people would bring animals to the temple and to the priest, and then the priest would sacrifice those animals on behalf of the people and their sins. This provided a way for sinful men to stand before a holy God. The law gave man parameters and limits. The law could not take away sins. It could not cleanse man. Even the sacrifices only provided the holiness man needed for a short time.
God did what the law could not do. He took away the sins of man. He gave man a way to stand before a Holy God permanently. He sent the ultimate sacrifice to die on the cross; Jesus was that sacrifice! He gave us a way to live by the Spirit (in accordance with the law). He FULFILLED the law!