You are passing to mousePressed() what is returned by invoking changeText(newInput) at that moment; which is undefined.
Instead, you need to pass the callback itself: button.mousePressed(changeText);
We can’t control when it’s invoked nor what is passed to a callback.
In order to access the variable inp anywhere, declare it globally, just like you did to button:
let button, inp;
Then you can access it inside changeText() callback:
function changeText() {
text(inp.value(), 100, 200)
}