Added.Let me explain better how this answer relates to the question since the OP asked for clarification. Being the monoid of all continuous maps is an algebraic property in the following sense. M is a monoid of mappings on a set X containing all constant maps iff M has a minimal ideal consisting of left zeroes and M acts faithfully on the left of this ideal.
So the question is equivalent to asking which abstract monoids are endomorphism monoids of topological spaces. (The set X, if it exists, must be the ideal of left zeroes.) This seems a hard question and I couldn't find an answer in the literature.
De Groot proved every group is the homeomorphism group of a topological space (and the isometry group of a metric space). Apparently he asked which monoids can be the nonconstant mappings of a topological space.
Original answer
Here is a partial answer to the second question. Among other things in Trnková, Věra Topological spaces with prescribed nonconstant continuous mappings. Trans. Amer. Math. Soc. 261 (1980), no. 2, 463–482 it is shown that given any monoid M, there is a topological space X such that the non-constant mappings on X form a monoid isomorphic to M.