How to modify a component of a BP file in CPP script?

// I wanna sync a component's data between 2 blueprints
auto BP_Male = Cast<UBlueprint>(UEditorAssetLibrary::LoadAsset("/Game/Blueprint/Character/H_Male/H_Male"));
auto BP_Female = Cast<UBlueprint>(UEditorAssetLibrary::LoadAsset("/Game/Blueprint/Character/H_Female/H_Female"));
if (BP_Male != nullptr && BP_Female != nullptr)
	auto CDO_Male = Cast<AUGActCharacter>(BP_Male->GeneratedClass->ClassDefaultObject);
	auto CDO_Female = Cast<AUGActCharacter>(BP_Female->GeneratedClass->ClassDefaultObject);
	if (CDO_Male != nullptr && CDO_Female != nullptr)
		// first duplicate a component from male blueprint, set CDO_Female as the outter object
		UObject* NewComp = StaticDuplicateObject(CDO_Male->PrefabDataComponent, CDO_Female, NAME_None, RF_AllFlags,CDO_Female->PrefabDataComponent->StaticClass());

		if (NewComp != nullptr)
			// then replace female blueprint with the new component
			CDO_Female->PrefabDataComponent = Cast<UUGPrefabDataComponent>(NewComp);

			// Save is OK, but when I open it in the editor, this component is totally empty!
			if (!UEditorAssetLibrary::SaveLoadedAsset(BP_Female, false))
				UE_LOG(LogUGEditor, Error, TEXT("Save female BP asset failed."));
				return false;
			return true;

This script compiles and runs ok, but the result is unexpected: the component is not synced from male to female, it turns to be null.
Why is that? Are there something I misunderstand about CDO or Outer Object´╝č