Every hexagon clearly has 6 sides. Nevertheless, every time you "glue" two hexagons together, you "lose" 2 sides to your count, because the sides where the two hexagons meet are not exterior sides anymore, and so they are not taken into account in our counting.
Also observe that with n hexagons you have n-1 points of contact between hexagons.
Since every hexagon has 6 sides and every gluing point takes away 2 sides, the number of exterior sides with n hexagons is
Let's plug some values for n:
You can check that these values are correct by counting the sides on the figure you have.
Finally, we can count the sides of a train with 10 hexagons by plugging n=10 in our formula:
Note: the numbers we've given are the number of sides that form the perimeter. So, the actual perimeters are the number of sides multiplied by the length of the side itself: if we let be the length of the side, the perimeters will be for the first 4 trains, and for the 10-hexagon train.