Jaise har gaari ka apna number hota hai usi tarah har locomotive ka apna unique number hota hai.
Example there are many WAP5 locos in IR.But bina koi specific identity ke bina kaise pata chalega konsa wap5 kis shed ka hai,maintainence kis loco ka karna hai etc.
So these 5 digits number are given to them which makes them apart from each other.