A VPN does not prevent keylogging. It only protects the device's data privacy, not malware.