Not sure if this is a bug, an undocumented feature, or a feature request, but I do not see a way to ensure the order of multiple additions to a file.
I was tinkering with a copy of my puppet.conf, adding a variable definition :
confdir = /tmp/foo/puppet
and then adding another definition that used it
modulepath = $confdir/custom/modules
And on repeated runs (removing the added lines each time), I cannot ensure the ordering and expect that in some cases things would break.