The list syntax has as assumption that is all the content of a list element is on one line. A return is the end of the list item.
It is possible to use a code block. To use <code>.... </code> syntax, you should not place the openings tag at the next line, but at the same line as the list item you like it belongs to.
For example the next syntax works:
===== Header =====
- First
- Second <code>
Some code
</code>
-Third
(There is a plugin that seems to do what you suggests, no idea whether the plugin is still uptodate and working or good enough:
https://www.dokuwiki.org/plugin:mllist )