How to update customer group programmatically Magento 2?

Update Customer Group in Magento 2 by Customer id for the customer.

If you want to change existing customer groups to different customer groups for the Customer you can do it using Customer Repository interface API.

To Retrieve the Customer Object by customer id, set Group id using the setGroupId() method to the return object and save the customer object to update group id.

Call method with a required parameter,

Follow the given code snippet to work as expected for the updated customer group.