Final working code. It can post to any number of groups at a time. Unfortunately it needs Facebook consent to post on group wall.
But a nice work.