Thats the key point: Impersonation in SP Designer Workflows does not run the step as the System User, but as the Workflow Author (explicitly: the user that last published the workflow). So if the permissions for the site owner group also get removed from the item (e.g. during replacing permissions), all subsequent actions will fail because the workflow author no longer has the right to set permissions himself. Yes, adding the workflow author to the Site Collection Admins will definitely prevent those issues.
– AnonNov 9 '18 at 13:04

Thanks guys .I switched my solution to another site collection and it worked.I think you need to be site collection admin to use the impersonation correctly.
– naijacoderNov 12 '18 at 5:17