In order to create attribute set programmatically in Magento 2, a custom script is used.
Note: You need to create an installer file InstallData.php in Company\Mymodule\Setup and add the code in it.
To get the script and code, visit the following blog:
Magento 2 Create Attribute Set Programmatically