All authors are required to state their affiliation, if they do not have an affiliation then they must state the institution that can be responsible for all research results or you should state your independent status. If the author is a student and not yet employed, you can write the name of the university, but if you are employed, you can write both.
If you have moved to another institution before the article is published, you must list the affiliation where the work was done, and include a note to state your current affiliation.

How to write affiliation can be found in the author guidelines section.