ugtrain: introduce 'output_mem_values()'

It is much cleaner if there is a single function to call per
purpose within the main() function. We also need to reduce its size.
So move the output of all memory values into a new function.