Accuracy results from a combination of rifling twist paired with the correct bullet weight, condition/grading of the bore, and how the barrel likes/dislikes certain bullets. If you get the perfect combination and remove all human and environmental factors (i.e. use a machine rest, no wind, etc.) it will land bullets on top of each other time after time. It's when you add in all the other stuff (trigger pull, flinching, wind, not knowing you bullet drop at range [which is where velocity {which itself is a combination of powder charge, bullet weight, and barrel length} comes into play], heartbeat, sight picture, etc.) that accuracy begins to suffer.
Besides velocity, the biggest impact of barrel length is kinetic energy transferred to the target. Much more KE transferred to the target at range from a M855 62 gr. bullet from a 20" barrel than a 14.5" or 10.5", since the muzzle velocity is higher out of the 20" than the other two. KE = 1/2 mv^2