1/4 note, 1/4 note, LineBreak directive, AllowLineBreak directive, 1/4
note, 1/4 note.
The reason for that order is that the first line of your script inserts
the AllowLineBreak directive while the cursor is on the third 1/4 note
of the bar, and so it is inserted before the third 1/4 note, then the
second line inserts the LineBreak directive while the cursor is on the
AllowLineBreak directive and so this is inserted before the
AllowLineBreak directive. (Insert is *always* before the object that the
cursor is on, unless the cursor is in the appending position).
As far as LilyPond is concerned the order is immaterial, because both
occur at the same "moment", that is, the same time in the music. The
upshot is that LilyPond typesets a line break after the second and
before the third 1/4 note because it has an invisible barline there and
a request to break the line on that invisible barline.