Once a piece grows past a few lines, naming sections as variables makes everything easier to read and maintain.

Match the target by moving the melody into a variable and referencing it in the score.

LilyPond manual reference

Target

Your Result

Click Check to compile and compare