LilyPond beams notes automatically, but you can override that when the musical grouping asks for it.

Match the target by beaming the eight eighth notes into two larger groups.

LilyPond manual reference

Target

Your Result

Click Check to compile and compare