I assumed you had your own movement component class, derived from UPawnMovementComponent. In that case, I was saying, your creation code should look like this
UMyMovementComponent *MyMovementComponent = GetPawn()->CreateDefaultSubobject<UMyMovementComponent>(TEXT("MyMovementComponent"));
But then again, you’d want to assign that instance to a member variable of the owning actor, so it’s not quite correct. I was just going off of what you had posted so it looked familiar.