How to create a simple Drupal module that updates a custom node field
Hooks, in a module, only work inside the .module file. 

You don't need a controller nor a routing file here, these are used for creating pages.

/modules/updateprices/updateprices.module

&lt;?php

use Drupal\Core\Entity\EntityInterface;

function update_prices_node_presave(EntityInterface $entity) {

  $entity_type = 'node';
  $bundles = ['product'];

  $fld_price = 'field_price';
  if ($entity-&gt;getEntityTypeId() != $entity_type || !in_array($entity-&gt;bundle(), $bundles)) {
    return;
  }
  $entity-&gt;{$fld_price}-&gt;setValue(10.75);

}