The phrase "there is" indicates the presence of the object of the sentence, without making the object the subject. The similar sentence "A book is on the table" would mean the same thing but restructures the statement to have a subject. Usually, when using the indefinite article "a", the statement will more often use "there is" to emphasize the presence of the book over the book itself.
The construct comes from the French term "il y a", literally translated as "that there has" but thought of by native French speakers as identical to "there is" (except conjugated using "avoir" instead of "etre"). As this shows, "there" basically replaces "il y" ("that there") from the French and so takes the place of the pronoun.
As for punctuation at the end of a sentence containing a quote, there are a lot of conflicting rules regarding punctuation in quotes. In American English, the rules are as follows:
- if the quote is not a complete, structured sentence, the punctuation should always be placed outside of the quote. (The defendant said that his actions were "lawful and appropriate".)
- if the quote and statement both end in a "forceful" punctuation (? or !), the punctuation should be placed outside the quote. (Why did the defendant say "Why are you questioning me"?) - this is the correct use of punctuation for your specific case.
- If the quote ends in "forceful" punctuation but the statement does not, use both punctuation marks, and place them inside and outside the quotes as appropriate. (When asked about his involvement, the defendant cried "I will not be interrogated by you!".)
- If neither the quote nor the statement are "forceful" (they'd both end in periods), and the quotation is a complete, properly structured statement, the punctuation goes inside the quotation marks in American English. In British English, traditionally the punctuation still goes outside, but American influence in English writing currently makes it about 50-50. (When asked about his actions, the defendant said, "what I did was lawful and appropriate to the situation.")