How to add variable using mytheme_preprocess_field and print using twig template?
Variables in a template are scoped - what you add in hook_preprocess_field will only be available in field.html.twig and its derivatives, not node.html.twig etc.

You can implement the same logic in the node preprocess:

function mytheme_preprocess_node(&amp;$variables) {
  if ($variables['node']-&gt;hasField('field_header') &amp;&amp; $variables['node']-&gt;field_header-&gt;isEmpty()) {
    $variables['myVariable'] = TRUE;
  }
}