Are these sentences both right ? :
Did you used to visit her ?
and
Did you visit her ?
Are these sentences both right ? :
Did you used to visit her ?
and
Did you visit her ?
Both sentences are correct.
Did you used to visit her?
This sentence asks about a past habit, meaning did the person visit many times over some time period ending in the past.
Did you visit her?
This sentence asks about a specific occurrence.