You are right in that you understood something wrong. Sed is indeed not supposed to overwrite the input file so, as you guessed, you will have to redirect (pipe) the output to a different file, e.g.:
sed 's/fr/us/' /etc/default/keyboard > keyboard2
then move keyboard2
to /etc/default/keyboard
(don't forget to make a backup copy of the original file, just in case).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…