I dont understand what x does when it comes to exchanging the contents of hold and pattern buffer.Does it exchanges the data between hold and pattern so that any previous data in hold or pattern is deleted.what happens exactly.
Probably the best way to explain those is translate to a more verbose language like
Now, the hold space contains what the pattern space contained (the current input line unless any other command modified it). And the pattern space is replaced with whatever the hold space contained, so will be output at the end before processing the next line of input (where the pattern space will be assigned the new input line).
The pattern space is what you work on. So you need the data in there if you want to do anything with it. The hold space is a storing area which can be used if you need to keep data between the processing of two lines of input.