Strain, $\epsilon = \Delta L/L$, is the ratio of deformation, not the deformation. Deformation along the beam even with the same $\epsilon$ is proportional to the length of the section we consider, like deformation for one foot of the beam is half of the deformation of two feet. It means deformation is not constant. The stress $\ \sigma $ is constant no matter which cross-section we consider.
We can think of the beam like a spring under compression. It compresses uniformly along its length but if we consider only 1/10 of its length the compression is 1/10 of total compression of the spring. And deformation for that section is 1/10th of the total deformation.
I had confused the strain with deformation. I corrected my answer to clear this mix-up.
It is the deformation that varies with section length, not the strain, apologies. And thanks to @JohnHoltz for commenting on that.