Editing exported rule files is not supported. The result is vaguely JSON but not documented, so you are on your own if you try that. The UI suggests backing up your hub before import/export, so hopefully you did that; if you're running into problems now after a botched import, the best solution is probably to restore from that backup. (If you don't have any rules you care to keep, removing RM itself and then reinstalling it would also do the trick.)
See:
EDIT: I should also add that it appears you were trying to get rid of a "phantom device reference." This happens sometimes, particularly if an action is deleted, though less often that it used to. The best way you can avoid this is by un-selecting any in-use devices before removing the action. I don't think the UI always lets you do this, so it's probably not 100% avoidable unless you create a new rule or, as suggested below, export and import the rule, using a placeholder or other device instead. But we've been told this is harmless (just possibly misleading), so if nothing in the rule is actually using the device, there shouldn't be any problems.
EDIT 2: Actually, it sounds like maybe you were just trying to get rid of an old device name you saw in the rule export. That I wouldn't even worry about at all (no actual device reference). This is likely just leftover from something as a result of how RM works internally, maybe a cache of device names for display purposes or generating the display text for triggers, conditions, or actions (none of which is really code, just a summary of your selections in the UI, despite the fact that it is presented in a sort of pseudo-code).