Use a <template>
element to design a HTML template that you can then reuse in your code.
<template id="Template1">
Hello, World !
<template>
<div id="Target1"></div>
<script>
Target1.appendChild( Template1.content.cloneNode( true ) )
</script>
This will insert the content of the template in the #Target1
div.