How do I write to a text file?

I was trying to use code I got from this answer forum to make custom nodes for reading and writing to text files but the code was from 4 years ago and I got some errors when I ran it. The code is as follows:

RWTxtFile.cpp

#include “RWTxtFile.h”
#include “FileHelper.h”
#include “Paths.h”

bool URWTxtFile::LoadTxt(FString FileNameA, FString& SaveTextA)
{
return FFileHelper::LoadFileToString(SaveTextA, *(FPaths::GameDir() + FileNameA));
}

bool URWTxtFile::SaveTxt(FString SaveTextB, FString FileNameB)
{
return FFileHelper::SaveStringToFile(SaveTextB, *(FPaths::GameDir() + FileNameB));
}

RwTxtFile.h

#include “CoreMinimal.h”
#include “Kismet/BlueprintFunctionLibrary.h”
#include “RWTxtFile.generated.h”

/**
*
*/
UCLASS()
class MAZE2_API URWTxtFile : public UBlueprintFunctionLibrary
{
GENERATED_BODY() public:

	UFUNCTION(BlueprintPure, Category = "Custom", meta = (Keywords = "LoadTxt"))
		static bool LoadTxt(FString FileNameA, FString& SaveTextA);

	UFUNCTION(BlueprintCallable, Category = "Custom", meta = (Keywords = "SaveTxt"))
		static bool SaveTxt(FString SaveTextB, FString FileNameB);

The errors are as follows:
One or more of the moduels specified using the ‘-module’ argument could not be found.

The command “C:\UnrealEngine-4.19.2-release\UnrealEngine-4.19.2-release\Engine\Build\BatchFiles\Build.bat UE4Editor Win64 Development-WaitMutex-FromMsBuild” excited with code 5. Please verify that you have sufficient rights to run this command.

I have zero experience with C++ and have no idea what to make of this so let me know if there’s a quick fix or a better way to go about what I’m trying to do.

The error suggests that you don’t have admin permissions on some file which is preventing it from running. But it is extremely difficult to read your code in its current form. Also exact copy-pasted errors would help.