implement and adopt write data to file.
at moment only 50 samples hardcoded only for acc