You need to either pass the value of the input as an argument to the function - or get the value within the function. Note that since you have the input type="date" - you can set the values of the date portions individually - or use the built in date picker. Its also worth noting that all the browsers treat inputs with type="date" differently - so you may want to alter that approach.
Anyway - the flow is - change set the date in the date field - then click the button and you will get your alert giving the date (value of the input) that you entered.
Also - one other thing - in dev, its better to console.log() your results for testing / debugging. I left it as the alert you had, but wanted to change it :)
function myFunction() {
let Weekendingdate = document.getElementsByName('Weekendingdate')[0].value;
alert(Weekendingdate);
}
<h2>Select Week Ending date </h2>
<input type="date" name="Weekendingdate">
<button onclick="myFunction()">Try it</button>