Your sentence would be fine if you just took out the word 'longing' : 'My dream is to be a doctor'.
'Longing' is not an adjective, so you can't use it before a noun.
You can use it as a verb - 'I'm longing to go back home' - or you can use it as a noun - 'I have a longing to go back home.' Those are the only two ways you can use it.