Modifying the DefaultEngine.ini through a utility widget

If you are looking to edit the config files in the saved/config folder:

if (!GConfig) return false;
    
GConfig->SetString(
        TEXT("/Script/EngineSettings.GameMapsSettings"), //section
    	TEXT("GameDefaultMap"), //Setting Name
    		TEXT("value string goes here"), //Value
    		GEngineIni //file to save
    		);
GConfig->Flush(false, GEngineIni); // Save the config file

If you are looking to edit the config folders in the root config folder:
Look for your setting in the engine settings module
https://docs.unrealengine.com/4.27/en-US/API/Runtime/EngineSettings/

in build.cs under PrivateDependencyModuleNames.AddRange
you need
EngineSettings

and your function will look something like this: (I needed one for setting packaging maps so I used UGameMapsSettings | Unreal Engine Documentation)

bool UOVFPPluginBPLibrary::VPOVFPSetPackagingMap(FString mapPath)
{
	UGameMapsSettings::SetGameDefaultMap(mapPath);
	return true;
}

Either way, wrap them in a blueprint library function like you did with reading the file