Yes, you can log out of one account and log in to a new account on the same device. As long as you are not exceeding the maximum number of accounts that can be used on the Instagram app, which is currently 5 accounts per device, you should be fine.
However, keep in mind that using multiple accounts on one device can sometimes trigger Instagram's security measures, especially if you are constantly logging in and out of different accounts. To avoid any issues, make sure you are using legitimate accounts, following Instagram's community guidelines, and using a secure password for each account. Additionally, try to avoid using automation tools or engaging in any suspicious activity, as this could also result in account suspension or termination.