That's kind of a tricky question. It is not possible if you are running the script as the same user. When you log out, you are closing the terminal session, so whatever script or processes that are initialized by the user that is logging out will stop as well, including your script to log you back in. However, if you have another user who is running the script to log you out then log you in again, I suppose that it is feasible, although it is not really advantageous...
That's kind of a tricky question. It is not possible if you are running the script as the same user. When you log out, you are closing the terminal session, so whatever script or processes that are initialized by the user that is logging out will stop as well, including your script to log you back in. However, if you have another user who is running the script to log you out then log you in again, I suppose that it is feasible, although it is not really advantageous...