It is very easy for us to learn what God wants and then we find ourselves sinning against Him anyway. Sin is when we disobey God, do wrong things or think wrong thoughts. Sin keeps us from being close to God, but when we "Confess" our sin (Tell God about it), God brings us back close to Him. We should be turning from our sin to the Lord Jesus.
Because Jesus took the punishment for sin on the cross, we can be forgiven. If you sin against God, pray and tell Him that you sinned, ask Him to forgive you, and to help you not to do it again. When God forgives us, He has promised not even to remember our sin any more. It's kind of like He gives us a big hug, and says "Let's forget about it and do things right from now on." What a great God we have!