On your MacBook Air, first check System Settings >> Accessibility >> Keyboard and make sure Full Keyboard Access, Sticky Keys, and Slow Keys are turned off.
Apple documents these keyboard accessibility settings here: Apple: Keyboard accessibility settings
Next, go to System Settings >> Accessibility >> Pointer Control and make sure Mouse Keys is off.
Apple notes that Mouse Keys uses the keyboard to control the pointer and can be toggled through Accessibility settings: Apple: Pointer Control settings
Also temporarily turn off Voice Control under System Settings >> Accessibility >> Voice Control, then test the problem again.
Apple describes Voice Control as allowing spoken commands to navigate and edit text: Apple: Accessibility features for mobility
If the problem continues, restart the Mac and test in TextEdit with no external keyboard, mouse, controller, or other input device connected.
If the text insertion cursor still moves continuously to the right, let me know; that will help narrow down the next diagnostic step without assuming what is causing it.