TRQ-2411: print the header only once

- added global variable print_header for indication "need print header"
TRQ-2411: error info prints on bottom of output
TRQ-2411: remove unused comments
TRQ-2411: add unit test for checking get_err_msg; change format of err string

- fix in get_err_msg(): change convertion from int to string
- add unit test