Christians and Jews believe that David and Moses and all the rest were great men. However as men they can sin.
More than that they can humble themselves before god and ask forgiveness.
The morale is that if great men can humble themselves before god then everybody else can too.
Proof that Moses sinned. Anger and rage is a sin. Moses got angry when the people worshipped the golden calf. In a rage he smashed the 10 commandments.