I created a variable, like this :
{% set checkboxHTML = \'\' %}
You have to use set, like this:
{% set checkboxHTML = '<button class="btn btn-default btn-md" data-id="' ~ b.id ~ '">Edit</button>' %}
Documentation: https://twig.symfony.com/doc/2.x/tags/set.html
Alternative method to solve this is using the expanded {% set %}
Do note when using this method, the content is considered being safe
{% set checkboxHTML %}
<button class="btn btn-default btn-md" data-id="{{ b.id }}">Edit</button>
{% endset %}
twigfiddle