The note, collected during a school sex education programme, also told of her worries about getting pregnant as a result of the attacks, which began when she was eight, it was said.
"I was forced to have sex with my father. How should I deal with it? Will I get pregnant?" the note read.
The girl, referred to as X to protect her identity, had been molested at least seven times, the High Court heard. All but the first of the alleged incidents involved rape. Not all of them made it to court.
The father, a 44-year-old builder known as H.K.H, faces two counts of rape and one of indecent assault in their Tuen Mun public housing flat between 2015 and 2017. He denied them all.
A video of a police interview with X was played in court on Thursday.
X said she initially dared not tell anyone about the attacks because her father said he could be taken away as a result.
But she eventually wrote to her general studies teacher anonymously two days after the last alleged rape, which she said happened on November 19, 2017.
The anonymous note was slipped into a box for pupils' questions, set up in their classroom as part of the sex education scheme.
The note prompted the school to take action to identify X, and later led to her father's arrest.
During the recorded interview, X, now 11, said that before the final attack she was told to go to her father's bed just before her usual bedtime.
She said her father then raped her, as she tried to kick him away. "It's very painful. Don't do that," she recalled saying.
She said that out of the about seven attacks, four or five took place between September and October 2017. All of them lasted for less than six minutes, she said, the very first occurring in 2015 when she was eight.
That time, she said, although there was no sexual intercourse, her father rubbed his genitals against hers.
All of the incidents took place in the absence of her mother, who moved away in 2016 when the couple sought a divorce following domestic disputes, the court heard.
X also testified on Thursday, over a video link. She denied making up the allegations, when cross-examined by her father's lawyers. She also denied having been coached by her mother, to frame her father.
The trial continues before Mr Justice Patrick Li Hon-leung on Friday.