Hey Mohammed, everyone seems to set things up slightly differently so I don’t think there’s one right answer, but if you baked out the animations like in the course which it looks like you did, try parenting the gun to the character’s root (which should be on the ground) instead and keeping the root motion of the gun. That way they can act independently but appear to stay perfectly in sync. Hope that helps!
You may also find these courses useful for later:
https://cgcookie.com/course/fundamentals-of-fps-ui-design
https://cgcookie.com/course/fundamentals-of-weapon-mechanics