I have just bought a Huion H640P tablet (just for writing notes), and use it with Ubuntu 18.04 with kernel 5.3.0-40-generic.
I installed digimend-kernel-drivers v9 to make the tablet work.
Now, how can I configure hotkeys on the tablet and make the configuration permanent so that I don't have to launch commands like:
xsetwacom set "HID 256c:006d Pad pad" button 1 key Ctrl z
each time I start Ubuntu? (for instance, I want to set button 2 for scrolling).
Since you already know the commands you need to use (based on your question), the vast majority of the information you need is already here. To clarify, a script is nothing more than a text file of commands that has its permissions set to executable.
To avoid having to run your script of commands every time, all you need to do is run the script at startup.
Once you've chosen your scripting language there are numerous resources that explain the syntax. If you get stuck on the programming aspect you can always ask find answers to specific questions by utilizing for example our sister site https://stackoverflow.com/
Personally I often use bash for simple scripts such as you seem to require, Here's a command reference However in your case you might not need that much. A simple script might be described as:
where command 1 is xsetwacom set "HID 256c:006d Pad pad" button 1 key Ctrl z
I don't have your hardware and as such am unable to test it's capabilities, you however can do this with a bit of research and effort. xinput could be a useful tool for this.
Try this page https://www.huion.com/download/, I was able to download the software to set the hotkeys from here which worked on ubuntu 20 for me.