Last time I used it for making buttonholes. Now it's stuck in this mode and not moving a bit to sew a regular straight line stitch. I've tried to change the needle position, but it's not working.
The gear responsible for moving stitch settings has failed. Either you're using a vintage (older than ten years) machine, or you have a newer one that might still be under warranty (which means the part shouldn't have failed and your warranty should cover the repair-replacement if you didn't cause the failure by mis-using the machine).
I do vintage machine repairs for my sewing students (I'm in Scotland after 50 years in the US) and have seen this on vintage machines often enough to be able to say: be sure the repair tech (this isn't a home fix, please trust me you need a pro for this!) tells you if he/she uses a salvage replacement part (far less reliable and unfortunately too many vintage parts have to be salvage) or newly milled (very reliable but hard to find for many vintage machines).
Also consider: get an estimate of the repair AND a complete servicing (oiling, cleaning, check-over for potential problems).
Sewing machine makers recommend an annual servicing but many machines will function perfectly well with basic home maintenance and a repair tech servicing every three-five years. But no more than five years because a good servicing can prolong the sewing life of a machine and really should be considered an essential cost of home sewing.