Is placing buttons on headers to the middle or extreme right side is correct or not? Could you please suggest me the appropriate place?
If it is a simple action that affects all of the content that is represented by the header (like close or minimize the whole section), it would be fine to have a button at the extreme right. If it is actions that relates to the inner content it would be better to have it below the header in a toolbar or in context with the affected parts of the content.
Centered like you have in your example does not look good. An option is to have buttons follow immediately after the header text, but it should still be related to the entire section, not just an action that affects parts of the content.
If done right, this can look good, and save vertical space on the page.
You should not place action links in the header. You should attach a toolbar below the header. Here you can see an example of a toolbar. Probably there will be more actions in the future, they should be grouped together at one place.