Your subconscious is allowing, if not authoring, these thoughts. So somehow it is coming to the surface when you’re otherwise focusing on homework. I’m guessing when you’re doing homework your mind is focused on one thing so your subconscious feels like it has license to play while you’re working. Does that make sense?
I’m interested in going deeper. When you hear these things, what does it make you think? For example, does it make you think of past sins or failures? If you had sold your soul, does that make you a zombie? Does that take away your free will? Does it seem like the enemy has triumphed over the blood of the cross, in your case?
The reality of the cross is strong enough that even if you intended on purpose to “sell” your soul, all Jesus has to do is say, “Father forgive him for he knew not what he was doing,” and you’d be forgiven. That is, of course, if you had done it on purpose which you know you didn’t. I say this because “on purpose” would be worse, spiritually, than “being fooled into it,” so given that in the worst case you can still be forgiven, this little message you get has no substance to back it up so like the other poster said, effectively it’s impossible.
I see no evidence you’re actually in danger from evil spirits, or you would have reported many other symptoms. I think you can just smile, and wave as it goes by, metaphorically speaking.
Alan