Updating structure field entries inside a hook

I’d like to update a structure field inside a hook after my page was updated. I read a lot of threads here in the forum to exactly this question but don’t get it work.

This is my hook with some sample content to update. The structure field has two simple text fields at the moment, which I’d like to fill with sample content. What am I missing?

    'page.update:after' => function ($newPage, $oldPage) {
      if($newPage->intendedTemplate() == "mytemplate") {

        $items = $newPage->myfield()->yaml();

        foreach($items as &$item) {
          $item['field01'] = 'Testcontent';
          $item['field02'] = 'More Testcontent';
        }

        $newPage->update(['items' => Data::encode($items, 'yaml')]);
      }

Your field is called myfield in this example.

But here you try to update a field called items.

Great, thank you so much!

$newPage->update(['myfield' => Data::encode($items, 'yaml')]);