Convert tpl template to twig template
In Drupal 8 you can use the drupal |render twig filter:

{{ myvar|render }}


Replace might be used as:

{% set customHTML = customHTML|replace({'[content]': content_section}) %}


having the variables all ready.

To convert your whole template to twig have a look at loops, also.