He's a young dog in a new location and feeling scared and alone. That's why he stops crying when you take him out of the room, because he sees you and sees that he isn't alone or abandoned.
Make sure that he gets plenty of exercise during the day and doesn't sleep in the late evenings so he's more tired when it's time for bed. Make sure that he is let out so he can do his business before settling down. If he's young, he might need to go out again during the night, and that's why he's crying. If that happens, let him out to do his business and then bring him right back to his room. You can also give him an old article of clothing that smells like you to sleep with.
Though I should warn that constantly checking on him every time he cries during the night will lead to trouble. If he doesn't have to go outside and is just crying because he's scared or alone, you going to check on him rewards his crying, which you won't want to do.
Hope this helps.