They were started in the 1800’s. The little red car at the end of the train.
They were originally constructed in a makeshift, cheap way. A small cabin like structure was built on a railroad flat bed car.
Then as railroads progressed, expanded, the Caboose was modified and improved. The Caboose after modification became a custom shelter so to speak for the “conductor” and “brakeman” of the train.
It had a kitchen, sitting area, and bunks. And then with further modifications, it had an upper window built in, so the crew could see forward. I call it a “crowsnest” of a train. This was constructed due to boxcars being much higher and blocking the front of the train to the conductor, brakeman, lookout man.
By the time the 1920’s rolled around, there were 34,000 Cabooses in use on American railroads in the United States. But then like all things, things change with “time” and technology.
A small device which cost only a few thousand dollars could be attached to the last car on the train which could give the engineer all the information he needed to operate the train safely. Hence, the “Caboose” faded.