Save 'Apply' Prefab

I have a window to edit a variable in the script
but I want to automatically save what has changed

I used:

gameObject.prafab.apply;

but does not work
is there any way to save? Apply Prefab?

have look at this, especially here.

I usually go

for Apply-like behaviour, using ReplacePrefabOptions.ConnectToPrefab