Synchronizing sine waves from solar panel and grid electricity
An inverter designed to connect to the grid (grid tie inverter as mention in a comment) will do the synchronising to the grid frequency as part of its operation, also it is designed to prevent conditions like “islanding” for safety.
Even if you correctly size and purchase the correct grid tie inverter, get it professionaly installed and commissioned - most countries require this.
I installed our gt inverter, but had it professionally commissioned as they know all the parameters acceptable for the electricity supply companies.