His work on nearly 600 episodes over 27 years shaped the show’s signature fusion of humor with pathos