Magento2: config data save using custom module

Magento2: I want to save encrypted value in core_config_data while setup upgrade without using config.xml. I am trying to use data patch file

VendorCredentialsSetupPatchDataAddData.php

$this->moduleDataSetup->startSetup();
        $privateKey = $encrypted = $this->_encryptor->encrypt($value);
        $publicKey = $encrypted = $this->_encryptor->encrypt($value);
        $this->configWriter->save(self::XML_PATH_PRIVATE_API_KEY, $privateKey, $scope = ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $scopeId = 0);
        $this->configWriter->save(self::XML_PATH_ENABLED, 1, $scope = ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $scopeId = 0);
        $this->moduleDataSetup->endSetup();

But entry is not saving. I have checked patch table entry and here patch get register.