попробуй так
<div id = "content">1<br>2<br>3</div>
<button id = "b">сoхранить</button>
<script>
b.onclick = function(){
var a = document.createElement("a")
a.setAttribute("href", "data:text/plain," + content.innerHTML.replace(/<br>/g, encodeURIComponent("\r\n")))
a.setAttribute("download", "filename.txt")
a.click()
}
</script>