How can I keep a sprite out of the edge?

Hello everybody. I need help. How can I keep a sprite out of the edge?