I am trying to insert custom tab into Activity tab but it is not working
I have an example of how I deal with creating custom groups and fields in an extension here: https://lab.civicrm.org/partners/civicoop/dmgeneriek/tree/master/CRM/Dmgeneriek/ConfigItems


The definition of the custom groups and fields are in the resources folder in json files
The ConfigItems class is initiated in the Upgrader (see https://docs.civicrm.org/dev/en/latest/extensions/civix/#generate-upgrader)


I recommend avoiding using hard coded custom group id's in your code.