I managed to solve the problem using solution in attachment, but it looks quite primitive...
Additional problem:
Suppose the case:
Acquisition 1 --> header and results are written in "results.lvm"
Acquisition 2 --> I want new data to be written in the same destination file "results.lvm" (append to the file). But I need the header to know when Acquisition 2 begins. Unfortunately, what happens is that new data are appended immediately after old data; header is updated at the top of the page and information on Acquisition 2 replaces that one on Acquisition 1.
Here is the reason because I need a more efficient header maker.