Hello, as Pablo Wang wrote, you use the word "a" a lot. We use "a" or "an" when we talk about one specific thing as in singular. For example in your sentence, the part with "have a problem to solve" is correct, because the problem is only one.
But in the other cases you're talking about the so called collective nouns. These are nouns that appear to be singular, but they talk about many things. For example "food" is in the singular form, there is no "foods", that's wrong. But into the category of food go many things. So it is not one specific thing and because of that, you can't use "a" in front of it. Just "have food to eat".
2) In the first part you used past tense: "thought" which is is correct, but you need to continue to talk about the past, so instead of "my life is unfortunate", it should be "my life was unfortunate". Because that's what you thought in the past.
3)Last small thing is, that the word "realize" fits way better into the sentence instead of "know". So: "until I realized I have..." This makes the change between your past thoughts and your current thought clearer.
I hope this helped!