How to write a technical paper of a not so significant idea?
Quite possibly, your supervisor is encouraging you to write early, to learn how to write, and to get into the habit of writing your results down.
You would gain a lot by watching this youtube video by Haskell inventor Simon Peyton Jones on How to write a great research paper. Part of his message is that you can do the research while you are writing, meaning that many ideas will come to you as you are writing things down.
You ask how to write a paper. Didn't you just read a whole bunch? Pick one that you found easy to follow and inspiring. Model your paper on its structure and style.
Regarding the actual work. A formal model of a for-loop has already been done, so I suspect that this is not the right level of abstraction to consider. What is the data to which your for loop applied? What did it mean? What did the parameters mean? How are the results of your code interpreted? Were some better than others? On what scale? Part of science is learning to ask and answer the right questions.
From the wording of your question, it looks like what you wrote can be summarized as "I wrote this code and obtained these results". Even if your code and results are correct (I assume they are, if they got your prof's attention), this is not a publishable paper. The reason is that "I wrote this code and obtained these results" is something that you can say of any piece of code that actually works, no matter how trivial or mundane. What your prof is expecting you to write is a paper that says "I wrote this code and obtained these results, and this is interesting to you, dear reader, because...". There are a bunch of reasons why your code is interesting: it might run faster than standard code for certain cases; it opens up a different way of attacking a certain problem; it shows that a certain cases have some properties that set them apart from their complement class; and so on.
If you had decided to go into industry after getting your BSc, you would be paid to write code that works, period. In grad school, on the other hand, whether your code actually works is to some extent secondary (cf. Knuth's quote "Beware of this code: I've proven it correct, but I haven't run it yet"). What matters is whether your code teaches your peers (grad students, postdocs, profs) something new about your (sub)field.