I could not able to get a clear understanding of TCP nodes and WebSocket node. where and why it is used
TCP is a low-level communication link, between sockets running inside different processes, or even different machines. Much of the programming done in the 1900's (especially before the web was born) used them to send data back and forth -- similar to the way we use Http now, but without the layered protocols that make our lives easier.
WebSockets are socket-level communication channels typically used to communicate between front-end web clients (e.g. JS scripts inside Html pages) and back-end services (web servers, node-red, etc). In fact, websockets are used within Node-RED to show debug data in the Editor's sidebar as it moves through the flow that is running on the server. It's also used by the dashboard to update the Html widgets with data, and to send button press events back to the server (and many more places).
I've not had a need to use any TCP nodes, but I do find the WebSockets useful -- for instance, I have a plain Html page that renders an empty log table. When that page is first loaded, it runs a script to create a websocket which listens for msgs from my flows. When my flow sends data through the websocket, the web page gets it as a JS object, and adds a new row to the table with all the data. Much nicer UX than using ajax and polling -- each event is "pushed" to the active web page as it happens.
Hope this helps -- and for the rest of you "old-timers", please forgive my over-simplified descriptions!
Not over-simplified at all
TCP nodes are rarely needed. If needed at all, most likely to talk to some odd service or piece of hardware that doesn't support something more modern. You are far more likely to use an http node than a bare TCP one.
The point about websockets is that they don't have to keep doing a handshake in order to exchange data. So they are ideal for an ongoing dialog. Have a look at the docs for node-red-contrib-uibuilder to see how websockets work together with web pages. The web page contains the main structure and code, the websocket provides an ongoing exchange of data between Node-RED and the loaded page (and back).