Electrifying yards could be worthwhile, but total US fuel usage for trains is about 3.5 billion gallons [346] out of about 46 billion gallons/yr [995].
High-end estimates are $5m per mile, at 140,000 miles it would be $700 billion, throw in a bit more for some new locos (probably could switch existing somehow), cool trillion.
Could be better spent money than other things we do.
The far more practical method would be for trains to haul thier own batteries. A couple freight cars full of lithium would provide substantial range without electrifying the entire track. And trains have amazing potential for regeneration during braking, if one can find a way to do it practically.