Luke literally calls out the reason stormtroopers don't hit in ANH.
"I can't see a thing in this helmet"
You can bet that the helmet is mass produced for a specific build/height. Anyone that doesn't fit it perfectly, can't see a thing and probably can't hit. Take the helmet off and become a better shot. Combine that with rifles produced for the masses and see what you get.
But yes, once they were on the Death Star, the point was to let them get back off and find the rebel base.