Steam Locomotives were first used in the 19th century and then continued to be used up until the 20th century.
Diesel Locomotives were first put into use regularly as early as the 1940's and then by the 1950's steam locomotives were mostly phased out in favor of the diesel locomotives.
And by 1960's steam locomotives were mostly phased out and not commonly used anymore in the USA.