How to change a command in chat for a key pressed?

Citizen.CreateThread(function() -- Whe create a thread
    while true do -- infinite loop that every 5 ms is executed
        -- 38 is the control of the E button
        if IsControlJustPressed(0, 38) then
            ExecuteCommand("atm")
        end
        Citizen.Wait(5)
    end
end)

Whit my library

IsControlJustPressed("E", function()
    ExecuteCommand("atm")
end)