Vaccines prevent _diseases_ that can be dangerous, or even deadly. Vaccines greatly reduce the _risk_ of infection by working with the body’s natural defenses to safely develop immunity to disease.
You're speaking nonsense. If you mean the vaccine doesn't prevent a virus particle from going into your body, you are correct. They aid the immune system in fighting the virus once it's inside. "Infection" is usually used when some boundary of viral load is crossed, a boundary almost impossible to reach through any means other than internal incubation. Hence, vaccines prevent infection.