A bit hard to tell, but if I understand correctly, it seems that code is in each of the blocks but there's one global direction vector for them all, and my guess is that since you're changing the direction when the leading block hits the edge, at that point some of the other blocks haven't had the chance to move yet, so they turn around before they should.
(you can probably see it if you reduce their speed drastically)
EDIT: it seems they also gain distance from the start (before hitting any edge of the screen for the first time). If that's the case, that's probably because the block in front of them hasn't moved yet. The move function from the KinematicBody only moves an object up to the point of collision, so if the 3rd block wants to move, but for some reason the 4th block hasn't moved yet, the 3rd block ends up standing still for this frame. If this is the case, you may want to have them move in order (from front to back), and probably invert that order depending on which direction they're moving.
Or deactivate collisions between them (out of the top of my head I can't say exactly how to do that -- I haven't been dealing with many KinematicBodies myself yet -- but it's probably something to do with collision layers), or move the remainder if the collision was with another block and after it moves. The move() function returns the movement that was left at the point of collision, you can store it in a variable.
Ex:
var remainder = move(motion)
# somehow test if block in front has moved, and if so:
move(remainder)
This may be tricky to implement though, it might be way easier to just move them in order.