For punishment the writer gets the cane somehow (7)
I believe the answer is:
penance
'for punishment' is the definition.
(penance is a kind of punishment)
'writer gets the cane somehow' is the wordplay.
'writer' becomes 'pen' (something which writes).
'gets' is an insertion indicator.
'somehow' indicates an anagram.
'cane' anagrammed gives 'ance'.
'pen' going inside 'ance' is 'PENANCE'.
'the' acts as a link.
(Other definitions for penance that I've seen before include "Self-punishment for sin" , "Act of contrition" , "act of expiation" , "Voluntary self-punishment" , "Act of atonement" .)