Save is deprecated when try to create attributes set

You can use the Magento\Eav\Api\AttributeSetRepositoryInterface; to handle the save attribute
Check this:

<?php

namespace Vendor\CustomModule\Setup;

use Magento\Eav\Setup\EavSetupFactory;
use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Catalog\Setup\CategorySetupFactory;
use Magento\Eav\Model\Entity\Attribute\SetFactory as AttributeSetFactory;
use Magento\Eav\Api\AttributeSetRepositoryInterface;

class InstallData implements InstallDataInterface
{
private $_eavSetupFactory;
private $_attributeSetFactory;
private $_categorySetupFactory;
private $_attribute;

/**
 * InstallData constructor.
 * @param AttributeSetRepositoryInterface $attribute
 * @param EavSetupFactory $eavSetupFactory
 * @param AttributeSetFactory $attributeSetFactory
 * @param CategorySetupFactory $categorySetupFactory
 */
public function __construct(AttributeSetRepositoryInterface $attribute, EavSetupFactory $eavSetupFactory, AttributeSetFactory $attributeSetFactory, CategorySetupFactory $categorySetupFactory )
{
    $this->_eavSetupFactory = $eavSetupFactory;
    $this->_attributeSetFactory = $attributeSetFactory;
    $this->_categorySetupFactory = $categorySetupFactory;
    $this->_attribute = $attribute;
}

/**
 * @param ModuleDataSetupInterface $setup
 * @param ModuleContextInterface $context
 * @throws \Magento\Framework\Exception\LocalizedException
 */
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
    $setup->startSetup();

    $categorySetup = $this->_categorySetupFactory->create(['setup' => $setup]);

    $attributeSet = $this->_attributeSetFactory->create();
    $entityTypeId = $categorySetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY);
    $attributeSetId = $categorySetup->getDefaultAttributeSetId($entityTypeId);
    $data = [
        'attribute_set_name' => 'YOUR_ATTRIBUTE_SET_NAME',
        'entity_type_id' => $entityTypeId,
        'sort_order' => 200,
    ];

    try{

        $attributeSet->setData($data);
        $attributeSet->validate();
        $this->_attribute->save($attributeSet);

        $attributeSet->initFromSkeleton($attributeSetId);
        $this->_attribute->save($attributeSet);

    } catch (\Exception $exception) {
        throw new InputException(__($exception->getMessage()));
    }


    // CREATE PRODUCT ATTRIBUTE
    $eavSetup = $this->_eavSetupFactory->create(['setup' => $setup]);

    $eavSetup->addAttribute(
        \Magento\Catalog\Model\Product::ENTITY,
        'attribute_id',
        [
            'type' => 'varchar',
            'label' => 'YOUR ATTRIBUTE LABEL',
            'backend' => '',
            'input' => 'text',
            'wysiwyg_enabled'   => false,
            'source' => '',
            'required' => false,
            'sort_order' => 5,
            'global' => \Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_STORE,
            'used_in_product_listing' => true,
            'visible_on_front' => true,
            'attribute_set_id' => 'TESTING ATTRIBUTE',
        ]
    );

    $setup->endSetup();
}
}