Cannot edit previous commands while using Up/Down Arrow key in terminal

Sometimes when I need a previous command or text and I navigate to it using the Up/Down arrow key, the previous commands get stuck on the display and can’t be edited. Though I can scroll between the commands but it’s just useless as I can’t run them and I have to clear the screen for it to work again.