program output is different in console and in virtual terminal

As you can read in the Debian man page for daemon, it vastly depends on how you implemented your daemon under which init system.

  • The SysV way (stdin/out/err connected to /dev/null)
  • The "New-style" way : (stdout/stderr directed to systemd-journald.service)

... 10.Instead of using the syslog() call to log directly to the system syslog service, a new-style daemon may choose to simply log to standard error via fprintf(), which is then forwarded to syslog by the init system ...

In this latter case, the behaviour you notice under your xterm is the normal way.

What the daemon outputs via fprintf (stdout / stderr) is then under the control of syslog.

Therefore, depending on your syslog configuration (as you find it in your syslog.conf file) and depending on the log level, what your daemon outputs will be ignored / appended to some particular file / echoed on the system console (your tty1), and never xterm.