This may be due to the Scribble function in iOS.
Please try turning off Scribble and see if that solves the issues.
▼How to turn off the scribble
Launch the Settings app on your iPad > Select Apple Pencil > Turn off Scribble
Please refer to the video below for detailed instructions on how to fix the issue.