An algorithm is an abstract concept like natural numbers. The concept refers to an approach to solve a problem or carry out a task.
Natural numbers are represented by symbols like 1,2,5,10 or I, II, V, X.
Algorithms are represented by text in natural language or by computer programs.
So essentially, at first you don’t have to write anything. You need to understand the problem and come up with an approach. There are ways to bridge the gap between abstract concepts in your head and a computer program. Examples are pseudocode or Nassi-Shneiderman diagrams. For more complex problems UML can be useful. Some people prefer to write code right away and see what happens. Trial-error can be a good method of problem solving.