I need to write it vertically in order to do the column become narrower and I don’t know how to do it.
Right-click on the cell and select Format cells. In the dialog that opens select the tab labelled Alignment and under Degrees enter your desired angle. You might also want to adjust the Horizontal and Vertical alignments as in image below.
The Calc Guide might be helpful as a reference. Cheers, Al