How modify vertex in static mesh? c++

Hello everyone! How i can modify vertex in static mesh using c++? I have c++ code to get the position of vertex, but i cant understand how modify vertex in realtime.

TArray<FVector> ADoorModify::MeshData(const UStaticMeshComponent* StaticMeshComponent)
    	TArray<FVector> vertices = TArray<FVector>();
    	// Vertex Buffer
    	if (!IsValidLowLevel()) return vertices;
    	if (!StaticMeshComponent) return vertices;
    	if (!StaticMeshComponent->GetStaticMesh()) return vertices;
    	if (!StaticMeshComponent->GetStaticMesh()->RenderData) return vertices;
    	if (StaticMeshComponent->GetStaticMesh()->RenderData->LODResources.Num() > 0)
    		FPositionVertexBuffer* VertexBuffer = &StaticMeshComponent->GetStaticMesh()->RenderData->LODResources[0].VertexBuffers.PositionVertexBuffer;
    		FStaticMeshVertexBuffer* StaticMeshVertexBuffer = &StaticMeshComponent->GetStaticMesh()->RenderData->LODResources[0].VertexBuffers.StaticMeshVertexBuffer;
    		 FStaticMeshBuildVertex* StaticMeshBuildVertex;
    		StaticMeshBuildVertex->Position =  FVector(0, 0, 0);
    	//	StaticMeshVertexBuffer->AppendVertices(StaticMeshBuildVertex,1);
    		if (VertexBuffer)
    			const int32 VertexCount = VertexBuffer->GetNumVertices();
    			for (int32 Index = 0; Index < VertexCount; Index++)
    				//This is in the Static Mesh Actor Class, so it is location and tranform of the SMActor
    				const FVector WorldSpaceVertexLocation = GetActorLocation() + GetTransform().TransformVector(VertexBuffer->VertexPosition(Index));
    				//add to output FVector array
    				const FVector test = FVector(0, 0, 0);
    					//GetActorLocation() + GetTransform().TransformVector() 
    				VertexBuffer->VertexPosition(Index) = FVector(1100.0, -1100.0, 110);
    				UE_LOG(LogTemp, Warning, TEXT("My Location is: %s"), *VertexBuffer->VertexPosition(Index).ToString());
    //	StaticMeshComponent->GetStaticMesh()->PostLoad();
    //	StaticMeshComponent = NULL;
    		return vertices;

Hello, may I ask you a question? There are some errors in my code and I don’t know why.

You are missing #include at the top of the file.

You should call rhilockbuffer after all.