Node.js script for truffle project error: Transaction with the same hash was already imported

I try to make transfer in truffle project with every incoming block headers
web3.eth.subscribe(‘newBlockHeaders’)
.on(‘data’, async block => {
// console.log(New block received. Block # ${block.number});

    tx = await myContract.methods.transfer(Wethkovan, '2000', admin);
    gasCost = await tx.estimateGas({ from: '0xa40342366d0833Fc89cb7Bf4238178B26af7623c' });
    txData = {
        from: admin,
        to: sc_address,
        data: tx.encodeABI(),
        gas: gasCost
    };
    await web3.eth.sendTransaction(txData);
    bal = await myContract.methods.balance(Wethkovan, sc_address).call();
    await cons(bal);
    await cons(`New block received. Block # ${block.number}`)
})

I try to make transfer in truffle project with every incoming block headers

web3.eth.subscribe('newBlockHeaders')
    .on('data', async block => {
        // console.log(`New block received. Block # ${block.number}`);

        tx = await myContract.methods.transfer(Wethkovan, '2000', admin);
        gasCost = await tx.estimateGas({ from: '0xa40342366d0833Fc89cb7Bf4238178B26af7623c' });
        txData = {
            from: admin,
            to: sc_address,
            data: tx.encodeABI(),
            gas: gasCost
        };
        await web3.eth.sendTransaction(txData);
        bal = await myContract.methods.balance(Wethkovan, sc_address).call();
        await cons(bal);
        await cons(`New block received. Block # ${block.number}`)
    })

When i run script with “node index” command i get error message “Error: Returned error: Transaction with the same hash was already imported” after some iterations. error message

But the script runs constantly without errors when i start it by command “truffle exec index.js” But i need to use “node index.js” to deploy script in heroku What do i do wrong with command “node index.js”?

Welcome, @vervv74 ! Let me check this and I will get back to you