Hello Rutuja,
You would want to use the DropDown Container widget: https://marketplace.mendix.com/link/component/111568
With this you can create a clickable user icon and show user details / logout button within that dropdown.
The documentation should be sufficient to help you on your way, also there is a clickable demo of the widget here:
https://dropdownpluginwidg-sandbox.mxapps.io/p/home
Hope this helps!
Edit:
Based on your comment, it gets a little tricky, the only way to get data to be viewed on a layout is to create A snippet.
Put your logic within the snippet and the snippet within a layout. It should look somewhat like this. |