Вставить можно так
<input id="keyboard-input" type="text">
<button type="button" class="key-button-new">1</button>
<button type="button" class="key-button-new">2</button>
<button type="button" class="key-button-new">3</button>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>
$('.key-button-new').click(function(){
var key = $(this).html();
$("#keyboard-input").focus().val(function(i, val) {
var begin = val.slice(0, this.selectionStart);
var end = val.slice( this.selectionStart, val.length );
console.log(begin + " " + end);
return begin + key + end;
});
});
</script>