I think this adage is very old and has been rephrased countless times (though with slight modifications), but the modern English adaption might be from the 20th century:
King Wuling, "A talent for following the ways of yesterday is not sufficient to improve the world of today." [Warring States Period]
Lieut. Col. J. L. Schley, "It has been ...
You can find in a episode of the Walt Disney's TV show "Zorro" the emissary from Spain said, "Ask not what Spain can do for you, but ask what you can do for Spain". That was filmed in 1959. Which was long before JFK said it.