It is not incorrect, it is just lacking any preceding context this phrase always follows preceding context.
First you need to mention something that requires or needed courage::: then you can say 'You need the courage to do such a thing'
But
'You need to have the courage to do such a thing'
'You need to find/pluck up the courage to do such a thing'
'You need to have courage to do such a thing'
'You need to find/pluck up courage to do such a thing'
are the most common ways to use the phrase and leaving out "the" is much more common.
Such is a determiner referring back to the thing just mentioned that requires you to use 'a' in that phrase.