Plugin generated unexpected output – No PHP errors

The unexpected output is the blank lines betwen ?> and <?php.

Avoid to close php tags and open them again with no reason. In your code, remove all the closing php tags (?>) and leave only the opening tag on first line.