CakePHP 3.x: How Can I automatically show the validation errors into view file

You can do this.i just modified your code a little bit:

public function edit($user_id = null) {
$user = $this->Users->get($user_id);
if ($this->request->is(‘post’)) {
$user= $this->Users->patchEntity($user, $this->request->data);
if ($this->Users->save($user)){
// do whatever you want after saving your data like redirecting to another action or setting flash messages.
}
}
$this->set(‘user’,$user);
}

Note: Calling the save method automatically validates the inputs…u dont need to call the error() method explicitly

if validation fails then your edit.ctp will be rendered with the form data as well as error messages