The code below is a TARGET .tmc file. It is a template I use to start all my scripts for my various Modules. It already has 90% of the code you need to create a fully functional script for Mod. All the TMWH buttons are scripted but not assigned. To assign a key, uncomment the appropriate line and enter your desired key, as described in the Editor Manual.
I've also put in handy generic copy and paste lines in easy to reach locations.
Create a new file in TARGET SE
Copy and Paste that into Editor window OVERWRITING what is there by default
Save as a .tmc
Compile and run
In DCS controls setion you will have to map your Joystick, Throttles, and Friction Lever Axis's under "Thrusmaster Virtual Controller" column.
The Slew stick is mapped as mouse axis already. You will see it move in Windows. It is a bit sensitive. Check the Script Editor Manual on how to adjust it.
You will also need to assign buttons to Left and right mouse buttons, as well as Scroll Up/Down in the UI_Layer in DCS.
I hope this helps and welcome to Editor Scripting.