Yes, David sinned without a doubt. His sin was not imputed.
Romans 4:7 -8
7 Blessed are those whose lawless deeds are forgiven, And whose sins are covered; 8 Blessed is the man to whom the Lord shall not impute sin. (Psalms 32:1-5)
Jesus is greater than David. He was born of the line of David, the promised one. He is the only man who was sinless. He is the King of kings and Lord of lords. He demonstrated his "authority" to the religious leaders and he openly broke the Torah without sin, demonstrating the more perfect way.
Christ did not say, "Whosoever cometh to me, and keeps the Torah or the laws of Moses..." What he did say is, "Whosoever comes to me and hears my saying and does them is like a man which built a house upon a rock" Luke 6:47.
Anyone who thinks that "love your enemy" is obeying the law of Moses doesn't know the law of Moses.
Anyone who thinks "except for fornication" is in the law of Moses, hasn't read the law of Moses.
Anyone who thinks "don't look on a woman to lust after her" is in Torah doesn't know Torah.
Anyone who thinks that gathering corn to eat on the Sabbath and telling a man to take up his bed on the Sabbath is not breaking the Sabbath simply hasn't read the old covenant laws (Numbers 15:33-35; Exodus 16:5; Jeremiah 17:21-22).
Christ did not do these things because they were permitted in the "spirit of the law which had been lost in the traditions of the elder." He did them to demonstrate "that he was Lord also of the Sabbath" (Luke 6:5).
Christ, like Moses, was a reformer and a law-giver. "The Lord your God will raise up unto you a Prophet from the midst of thee, of thy brethren like unto me; unto Him ye shall hearken" (Deuteronomy 18:15).
"Which [tabernacle of Moses] stood only in meats and drinks and carnal
ordinances, imposed on them until [but only until] the time of reformation. “Christ being come" (Hebrews 9:10 & 11).
The supremacy of the Messiah is established, and the greater than Moses arrived. Hebrews 7:12 "For when the priesthood is changed, the law must be changed also."
Jesus proceeded to change the law, his commands were given to him by the Father and they were in part reiteration and others completely new.
John 12:48-50
48 He that rejecteth ME, and receiveth not my words, hath one that judgeth him: the word that I have spoken, the same shall judge him in the last day. 49 For I have not spoken of myself; but the Father which sent me, he gave me a commandment, what I should say, and what I should speak. 50 And I know that his commandment is life everlasting: whatsoever I speak therefore, even as the Father said unto me, so I speak.
John 14:15
If you love me, keep my commands.”
John 14:21
He that hath my commandments, and keepeth them, he it is that loveth me: and he that loveth me shall be loved of my Father, and I will love him, and will manifest myself to him.
John 14:31
But that the world may know that I love the Father; and as the Father gave me commandment, even so I do. Arise, let us go hence.
1 John 3:23-24
And this is his commandment, That we should believe on the name of his son Jesus Christ, and love one another, as he gave us commandment. And he that keepeth his {the Son's} commandments dwelleth in him, and he in him. And hereby we know that he abideth in us, by the Spirit which he hath given us.
John 15:10
If ye keep my commandments, ye shall abide in my love; even as I have kept my Father's commandments, and abide in his love.
John 15:12
This is my commandment, That ye love one another, as I have loved you.
John 15:17
These things I command you, that ye love one another.
Romans 13:9
For this, Thou shalt not commit adultery, Thou shalt not kill, Thou shalt not steal, Thou shalt not bear false witness, Thou shalt not covet; and if there be any other commandment, it is briefly comprehended in this saying, namely, Thou shalt love thy neighbour as thyself."
1 John 3:23
And this is his commandment, That we should believe on the name of his Son Jesus Christ, and love one another, as he gave us commandment.
1 John 4:21
And this commandment have we from him, That he who loveth God love his brother also.
2 John 1:5
And now I beseech thee, lady, not as though I wrote a new commandment unto thee, but that which we had from the beginning, that we love one another.
2 John 1:6
And this is love, that we walk after his commandments. This is the commandment, That, as ye have heard from the beginning, ye should walk in it.
Romans 13:8
Owe no man any thing, but to love one another: for he that loveth another hath fulfilled the law.
Romans 13:10
Love worketh no ill to his neighbour: therefore love is the fulfilling of the law.
Galatians 5:14
For all the law is fulfilled in one word, even in this; Thou shalt love thy neighbour as thyself.
The new and better covenant is in force today.