ffprobe: rework/fix ini writer

Do not build from scratch the section header for each section, but build
it using the previous level buffer, thus improving efficiency.

Also fix some few corner cases related to numbering which are exposed by
the pending disposition patch.
