Not able to Update database while creating a custom module

WordPress recommendations for the register_activation_hook hook are:

  1. Don’t do echo directly in the register_activation_hook callback function. Do it other hooks like init or admin_init
  2. Make sure you are closing the PHP tag ?>. Otherwise, you will get the Header already sent notifications.

I have tested your code, I think you are closing the PHP tag ?> at the end of the file.