I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.
You create the button element and set the text but you never actually add the button element you created to the DOM. So you can’t query for it.
You have a typo as well insertAdjacentElemeny.
Edit: You pretty much want most of your code to be inside the onclick handler.
Inside the handler:
Create the li set its text to the input element value. Append it to the ul.
Create the button, set its class and text, then add the event listener to it. Insert it to the list.
Example
const addButton = document.querySelector("#add");
const ul = document.querySelector(".hour");
const text = document.querySelector("#input");
addButton.onclick = function () {
const list = document.createElement("li");
// get the value from the input element
list.innerHTML = text.value;
ul.appendChild(list);
const button = document.createElement("button");
button.classList.add("btn");
button.innerHTML = "Remove";
button.onclick = function (e) {
e.target.parentNode.remove();
};
list.insertAdjacentElement("beforeend", button);
};