First sentence is correct, second is ungrammatical and meaningless. If you can't see why, consider how you would answer those questions: "What is that an ad for?" "That is an ad for soap powder." Makes sense. "What is that an for?" "That is an for ..." Makes no sense. You can't have "an for"; there's a noun missing!