const answer=document.querySelector('.answer-inpt')
const button=document.querySelectorAll('.button')
button.onclick=function(){
answer.value+=button.text;
}
<div class="number">
<a href="#" class="button">1</a>
<a href="#" class="button">2</a>
<a href="#" class="button">3</a>
<a href="#" class="button">4</a>
</div>