as its name implies:
document.getElementsByTagName
returns a collection of tags not a single node, I said a collection because it doesn't actually return an array but it returns an array-like object.
If you only need to get the html node, you can simply do:
document.lastChild.style.backgroundColor = "white";
and also
document.documentElement.style.backgroundColor = "white";
but if you need to find it using a finder function like that, you should do this instead:
document.getElementsByTagName("html")[0].style.backgroundColor = "white";
and also this one:
document.querySelector("html").style.backgroundColor = "white";