This is actually a great question and one that many people, especially students get wrong. When providing an in-text citation, the period always comes after the citation.
If you end the sentence before giving the in-text citation, it no longer is clear what the citation is referring to and is a big mistake for MLA citations. MLA is just one of the different citation and writing styles that students may be required to use. APA format is another very common style usually used in college and in the sciences.