Why do normally trains have 24 coaches?

The length of train in Indian Railways depend upon the Loop Line length and the length of the railway platform.

The length of the train should never exceed the length of the Loop Line as it has to fit in the loop line, so that a clear way is given to the other train which accesses the Main Line. It should not even exceed the platform length, as all the coaches should have the access of the platform for easy access.

In Indian Railways, the minimum length of the loop line is around 650 meters. In order the train to fit in this loop line, the train length should be less than 650 meters.

An ICF coach has a length of 22.28 m(buffer to buffer) and a LHB coach has a length of 24.70 m(buffer to buffer)

Now assuming that the train is hauled by a WAP7 which has a length of 20.562 m(buffer to buffer) you have a train length of

(22.28*24)+20.562= 555.282 m in case of ICF coaches.
(24.70*24)+20.562= 613.362 m in case of LHB coaches.

This is why the number of coaches is restricted to 24 coaches.

In order to increase the number of coaches, the loop length and the platform length should be significantly increased.