There's really no law in the United States that say how long a train in the USA can legally be but the longest that trains are in the United States are 6,600 Ft.
However trains are not supposed to block railroad crossings longer than 20 minutes and if the train is blocking the crossing longer than 20 minutes or the train is gonna be stopped longer than 20 minutes then the train must be uncoupled from the train cars to allow people to cross the rail road crossing.