The easy solution would be to cut them all to the same length.
The alternate solution would be to use a rectangular shape layer as a track matte.
Assuming you want those circles at the ends of the path, the first solution would be better. With a track matte you would need another copy of the layer with a synchronized track matte of just the ends of the lines, which you could get to resemble circular caps with minimax.
Or then you can spend a lot of time coming up with an expression that takes into account the horizontal length of each path and using a percentage to calculate the relative trim path ends for each path.
Kalleheikki Kannisto
Senior Graphic Designer