document.getElementsByClassName("tagtype"), will return an HTMLCollection which does not have an append() method. Use [0] with getElementsByClassName to get the first element, otherwise varName is not treated as an element but a collection.
var varName = document.getElementsByClassName("tagtype")[0];