You should sort out where and what type of document object you have. I see with document.getElementById("btnSave") you use DOM document, but with document.save() you try to use Ps Document, which probably is still the DOM one. These are completely different things.
Your code makes it look like you are trying to save this HTML document when what I think you’re trying to do is save the active document in Photoshop, though I’m not entirely sure. However, if this is the case, you need to define the active document first: