Add to Custom Entity Content on Node add/update
You can do like this

Suppose your entity name is my_entity.

&lt;?php
use Drupal\my_module\Entity\my_entity;

function my_module_form_node_form_alter(&amp;$form, \Drupal\Core\Form\FormStateInterface $form_state)
{
    foreach (array_keys($form['actions']) as $action) {
        if ($action != 'preview' &amp;&amp; isset($form['actions'][$action]['#type']) &amp;&amp; $form['actions'][$action]['#type'] === 'submit') {
            $form['actions'][$action]['#submit'][] = 'my_module_node_form_submit';
        }
    }
}

function my_module_node_form_submit($form, \Drupal\Core\Form\FormStateInterface $form_state) {
    $node = $form_state-&gt;getFormObject()-&gt;getEntity();

    $url = $node-&gt;field_website-&gt;uri;
    $name = $node-&gt;field_com-&gt;value;

    // Now to check    
    //Generate my_entity entity.
    $entity = my_entity::create(
               [
                 'label' =&gt; 'token',
                 'id' =&gt; $node-&gt;id(),
                 'status' =&gt; true,
                 'name'=&gt; $url,
                  "url" =&gt; $name,
                  "created" =&gt; time()
               ]
         );
    $entity-&gt;save();
}


To update enity:

$entity = my_entity::load('content entity id');
$entity-&gt;set("name", 'name value');
$entity-&gt;set("url", 'url value');
$entity-&gt;save();