What exactly do you have to program to make HID mouse, keyboard, device...

The really simple way is to buy an Arduino like the Arduino Micro that has an ATmega32U4 MCU. This chip has a native (built in) USB controller so it is simple to use Keyboard/Mouse commands.