I'm not used to Cocos2D engine, but I can suggest this solution for you to apply to your game.
The simplest way to implement a train wagon can be making an object which follows a given path, whose angle rotates according to the path direction. Given a path (as an open line or closed polygon) consisting of a finite number of points, the direction along the path can be computed with the inverse tangent (or any equivalent function) of the two vertices representing the current line segment the train is moving onto.
This leads to an issue: when turning, the wagons will be always centered to the railway track, because we are rotating every wagon object considering its sprite origin only, and we'll see wagons edges too unnaturally distant from one another. Also, if the path quality (aka the number of segments making up our line or polygon) is low, wagons sprite will abruptly change its rotation angle when moving from line segment to line segment.
Real train wagons are usually bonded to the railway track by two or more couples of wheels; the rotation of every wagon when turning depends on the position of its wheels.
Instead of working with one point only, which represents the center of mass (or origin) of our wagons, we can consider two points per wagon, each one representing the midpoint of every couple of wheels. Such midpoints are here coloured blue:
This way, we force these midpoints to travel onto the railway track, making sure their relative distance never changes, and midpoints belonging to different wagons always keep the same relative distance as well.
The final touch is drawing the wagon sprites with origin in the midpoint between the two previous wheels midpoints, and its rotation angle will be the inverse tangent of the two wheels midpoints as well. The direction will be correct since the midpoints are forced to the path.
Hope that helps you solving your issue, or developing a more appropriate solution on your own.