Sounds like you accidentally touched the endstop VCC pin to ground, it causes a short that fries the 5V voltage regulator very quickly. The good news is replacement Mega 2560s are only $7.50 from Ebay or $12 from Amazon. Are you trying to reprogram the old one or program a new one? Reprogramming the old one will not fix your voltage regulator – it’s a hardware component, not software. You can try soldering on a new replacement voltage regulator, but it’s not really economical unless you happen to have a place locally that you can get the voltage regulators without paying shipping. You can even try removing the voltage regulator altogether – it’s only used to convert the 12V from RAMPS into 5V for the Mega – if you’re hooked up to USB it can just get the 5V that way.