TypeError thrown

Argument 1 passed to DOMNode::appendChild() must be an instance of DOMNode, string given