The Ares Project (https://www.aresnorthamerica.com/) did something like this with robot trains shuttling concrete blocks up and down a slope. No news on that project in awhile tho. I hope this idea is more successful.
Quick question: how does the electricity get from the train (in motion) to the grid? Using the rails as conductors could work, but I'm not sure how efficient that would be.