The sentence is perfectly fine for the sense the Original Poster intended - and Original Poster is also correct that if they move the word only, the meaning would be different. Unfortunately, however, the sentence is also ambiguous.
The two available meanings are:
- You cannot do all these things outside that city.
- You can do all these things within that one city alone.
The ambiguity arises because the word only can be seen to scope over the word can, which gives you reading number (1), or can can be seen to scope over the rest of the VP including the word only, which gives you reading number (2).
The Original Poster clearly intends meaning number (2), but there is no way to prevent the reader from understanding meaning number (1). Unfortunately for the Original Poster, if meaning number (1) is understood to be the intended meaning then this wouldn't be the most natural place to put the word only - which is why their teacher said it was wrong.
The best option here is a complete rephrasing:
You can do all these things within that one city.