I am currently using a visualforce page inside a lightning component.Is there any way to set the parent lightning component attribute from visualforce page or send data to the lightning component from visualforce page?
The only official mechanism for this sort of communication is the Lightning Message Service.
Note that you cannot directly embed a Visualforce page within an LWC. The best you can do is to use an iframe with the URL for a Visualforce page inside the LWC.
However, since URLs for the two different types of page (lightning vs visuallforce) cannot be programmatically determined within the same context due to a lack of any API to do so, I strongly recommend against such an approach and feel you should simply include both a Visualforce page and an LWC that interacts with that page via LMS in the same Lightning Page. I.e. the components are simply siblings on the page.