You have to accomodate the space, if the expected result is:
“This is the first sentence. This is the second sentence.”
You need to insert space in either end of first sentence or at the beginning of second sentence, your current answer will give this:
“This is the first sentence.This is the second sentence.”