Beginners sometimes cough during practice. The most common reason is that breathing is not being regulated smoothly. You may be breathing too fast or holding your breath. Use Yi to regulate the breathing until it is no longer necessary.
The second possibility is that your body is not regulated correctly. For example, if you push your head too far back, the front of the throat will tense and cause you to cough.
The third possibility is that when you are in deep meditation, your heartbeat slows, and body temperature drops. You feel cold, which may also cause coughing, so keep your body warm during meditation. Drink a little water.