How can I copy a body field from one node to another node?
Use hook_ENTITY_TYPE_prepare_form if you want to change a field value before the form is built for an existing node:
&lt;?php

use Drupal\node\NodeInterface;
use Drupal\Core\Form\FormStateInterface;


/**
 * Implements hook_ENTITY_TYPE_prepare_form() for node entities.
 */
function mymodule_node_prepare_form(NodeInterface $node, $operation, FormStateInterface $form_state) {
  if ($operation == 'edit') {
    if ($node-&gt;id() == '6716') {
      $node-&gt;field_vertragsinhalt-&gt;value = $getcontract;
      $node-&gt;body-&gt;format = 'full_html';
      // don't save the node yet, it will be saved after submitting
    }
  }
}

For the more common case of setting field values when creating new nodes see Pre-populate an entity reference field (media image) when creating a node