var element = document.getElementsByСlassName("js-store-prod-sold-out")
if (element.length > 0) {
var button = document.createElement("button");
button.innerHTML = "Do Something";
var body = document.getElementsByClassName("js-store-prod-all-text
");
body[0].appendChild(button);}
var body = document.getElementsByClassName("js-store-prod-all-text");
Не нужно делать перенос строки.