Why, because if the train met with any accident or coaches are separated then it is easily identified by just observing the last compartment of Train.
2. It works as an alert system
If the train passes without the "X" letter painted with yellow color and there is no change or separation of compartments during its journey then the train authority takes appropriate action on it
3. Only present on the last compartment of every train
This yellow sign of train only present on the last coach of the train and one person also stand there and wave green flag for signal of departure of the train