You are doing it wrong. Type exactly this (except things in angle brackets which are dependent on things that you want to do), one line at a time, hitting enter in between each command.
walletpassphrase <passphrase> 120
dumpprivkey <address>
where <passphrase> is the passphrase you used to lock your wallet. <address> is the address you want the private key of. Repeat the second command (dumpprivkey) for as many addresses as need the private key of.
Then take the private keys (they will be output as black text beginning with a '5', 'K', or 'L') and import them into electrum.