If it's actually a character body, then the code will be something like this:
ParentNode.Velocity = velocity;
ParentNode.MoveAndSlide();
Velocity is a vector3 for the direction, and ParentNode is the characterbody3d in this case, BUT godot 4 has a script template for simple WASD/jump movement that you can pick when making your characterbody. It has good demo code that shows how to do things:
