I recognize that line immediately as part of The End, the last song on Abbey Road. Paul was always brimming with catchy melodies. Even Maxwell Silverhammer, a lovely, bouncy little tune about a serial killer. It’s what they used to call a ‘Toe-Tapper’.
Allegedly that's the song that ultimately broke up the Beatles, because the other band members were upset that Paul was spending so much time on getting that song right, it led to the row that wound up breaking up the band.