Insert plugin html content to a specific spot in the frontpage

Since the DOM elements on the frontpage will never change once the site is finished, the solution I came up with, was to find the div that I wanted to follow with my plugin content using javascript, and then just append my html content to the end of div like the following:

$imageMap = "<div style="width:1080; margin:0 auto;position:relative;top:20px;margin-bottom:20px"><img src="https://wordpress.stackexchange.com/questions/275794/$url"></div>";
echo '<script>
    document.addEventListener("DOMContentLoaded", function(event) {
    var el = document.getElementById("main-content").getElementsByTagName("div")[1];
    el.innerHTML += "'.$imageMap.'";
});
</script>';