He said a similar quote in his inaugural address on January 20, 1961, which is known as "Ask not what your country can do for you – ask what you can do for your country."
While the exact phrase "Yeh na dekho ki desh tumhe kya diyayeh, socho tum ke liya kar sakte ho" may not be a direct quote from Kennedy, it reflects the same sentiment and is often used to inspire civic duty and national service.