How can I gradually change the element from my page?

I’m trying to display all elements of an array, by iterating through the arrray, but after I chose the file (from the input), the element in page changes to : “unidentified”. Why?

function getElement() {
    console.log('sfgsdf')
    document.getElementById('files').onchange = function() {
        console.log('sfgsdf')
        let file = this.files[0];
        let reader = new FileReader();
        reader.readAsText(file);
        reader.onload = function() {
            variableIs = this.result

            function sleep (time) {
                return new Promise((resolve) => setTimeout(resolve, time));
              }     

            function display(asd) {
                const usingSplit = asd.split(' ')

                lengthOf = usingSplit.length

                for (var i = 0;i < lengthOf;i++) {
                    sleep(1000).then(() => {
                        document.getElementById('test').innerHTML = usingSplit[i];
                    });
                }
            }
            display(variableIs);       
        }
    }   

}

getElement()

The HTML code is just this simple one :

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h1 id="test">TEST</h1>
    <script src="test4.js"></script>

</body>
</html>