This will show how to use Twig in your D7 module

Setup your composer.json to pull in twig.

Then setup your template files

Then the buttons I include

finally load the template and add your variables