When middle-aged people focus on work that is directed toward others rather than themselves, Erik Erikson called this generativity. Erikson describes the term generativity in his seventh stage of psychosocial development, called generativity versus stagnation.
Generativity involves creating and accomplishing things that make the world a better place and caring for other people.