Can having an ear infection permanently change the structure of your ear inside?

Yes, but rare. An infection of the ear can occasionally spread into the inner ear and lead to damage of the hearing hair cells. With some infections new bone will fill in the fluid filled spaces of the inner ear. Both of these changes would be permanent. Fortunately, the barriers to bacterial spread make these unusual events.
Otitis. Having a few ear infections will probably not do damage to the ear. The main part of the ear that is commonly affected are the eardrum and the 3 tiny bones called ossicles in your middle ear that transmit the sound waves to the inner ear where real hearing takes place. Frequent and repeated infections can cause scarring of the eardrum and the ossicles which renders them to function inefficiently.