Ginny Weasley was a student at Hogwarts during the events of "Harry Potter and the Chamber of Secrets" and was not in a relationship with Harry at that time.
The poem you may be thinking of is a love poem that Harry finds written on a piece of parchment in the Room of Requirement in "Harry Potter and the Order of the Phoenix." The poem is not from Ginny, but from an anonymous admirer who is revealed to be Luna Lovegood.