Character sex/gender is only updated when the character undergoes a change which would be likely to change it. These changes are pretty much all driven by the player, though using too many potions too quickly can cause random mutations.
If the game crashes anytime you add a new line, even a blank one, then your editor is adding the wrong set of newline characters (the invisible characters that cause editors to put text on a new line) whenever you press the Enter/Return key.
If you don't have programming experience with Python, then I recommend taking a free online interactive tutorial for Python. GDScript is designed as a beginner friendly version of Python with some LUA, but since Python is a primary programming language it gets some better tutorials. A few hours with a tutorial will make things a lot clearer.
For simple debugging I recommend the Debug mod: https://itch.io/t/1137280/debugmod-v10d
I tend to do most of my programming in Sublime Text 3 with Python syntax highlighting and use the Debug mod to find out what breaks.
Otherwise get the Godot Editor version 3.3. It is needed if you want to work with the GUI, though it won't be much help for making mods.