Here from a Samsung guide,
If however the problem is flashing TWRP, you don’t say if you are using Windows or Linux. In Linux (depends on distro) Heimdall probably needs android-udev-rules
https://doc.e.foundation/pages/insufficient-permissions,
https://developer.android.com/studio/run/device.html
https://github.com/M0Rf30/android-udev-rules