The logic you've put in place to check the HTML elements is wrong, and the code won't even run, as described below:
const line = document.ul.child
if(line > 5){
e.preventDefault()
ToDo()
input.value = ""
}
Instead you need to use proper logic:
e.preventDefault();
const children = memo.children;
if (children.length < 4) {
ToDo();
input.value = '';
}