You and your friend are on vacation together. You're in a hotel room, and the bed was uncomfortable. Your friend asks how you slept, so you answer. "I was tossing and turning all night"
(someone) is tossing and turning
When someone can't sleep well, they turn over in bed a lot to try to find a more comfortable position. This is known as "tossing and turning". Another way to describe this situatiion is to say that a person's sleep was "restless":
She's always been a restless sleeper. She tosses and turns all night long.
Neither "tossing" nor "turning" by themselves express this meaning of sleeping badly.