Orienting the control points of a curve to the normal of a surface

Hello, I want to quickly move the control points of the white line shown in the picture to the normal of a surface, but I can’t do this without the red line. Is it possible to do this? I explained it to you with a video, I hope I can achieve this.I had the artificial intelligence test this. It was written as a script, but I could not get a successful result.