You need an on-grid or grid-tie nverterinverter, and you can buy them far cheaper than you can possibly build them. In any case the power company and electricity regulator won't let you implement the circuits yourself unless you're prepared to spend thousands on certification tests, including requirements to, for example, shutdown within a millisecond of mains loss.