I have a website which is a few years old now, it basically offers downloads.
Anyway since moving server people can not download files because its now giving a error
This problem is related to some output which appears before you send headers.
It is a common problem that some characters like spaces, new lines or even UTF-8 malformed BOM (Byte order mark) are placed before starting php tag.
You need to be sure that absolute nothing is echo-ed before sending headers and need to check that for all included files in your script.
In addition, ob_clean(); and flush(); functions are not needed in you code.