Tak že takto?
<html><head></head><body>
<input id="name" value="aaaa">
<a href="#" onclick="downloadHTML()">Download HTML</a>
<script>
function downloadHTML (){
var anchor = document.querySelector('a');
anchor.setAttribute('href', 'data:text/html;charset=UTF-8,' + encodeURIComponent(document.documentElement.outerHTML));
anchor.setAttribute('download', 'index.html');
}
</script></body></html>