If I understand the question correctly, you can use TikZ together with the titlesec package to do the job; something along these lines:
\documentclass{article}
\usepackage{titlesec}
\usepackage{tikz}
\usepackage{lipsum}
\titleformat{\section}
{\normalfont\Large\bfseries}
{\tikz[remember picture,overlay,baseline=-6pt]
\node[fill=cyan!60!black,minimum width=1.5em,align=center] (a) {\thesection};}
{1em}
{\tikz[remember picture,overlay]
{\draw[cyan!60!black,ultra thick]
(a.west) -- +(-10pt,0pt) |- ([xshift=-20pt,yshift=-20pt]current page.north east);
\node[fill=cyan!60!black,minimum width=1em,minimum height=1em]
at ([xshift=-20pt,yshift=-20pt]current page.north east) {};
}%
}
\begin{document}
\section{Test Section One}
\lipsum[1-4]
\section{Test Section Two}
\lipsum[1-4]
\section{Test Section Three}
\lipsum[4]
\end{document}

In a comment, str. has explained the design he/she wants to achieve; the idea is to get a snake pattern, formed with straight horizontal and vertical rules, zig-zagging through the sections of the document. This requires considerably more job, but is still possible; the code needs three or four runs to stabilize and some work has still to be done for the case of a page break near a section start:
\documentclass{article}
\usepackage{tikzpagenodes}
\usepackage{titlesec}
\usepackage{refcount}
\usepackage{xifthen}
\usepackage{atbegshi}
\usepackage{etoolbox}
\usepackage{lipsum}
\newcommand\pos{}
\newcounter{seccount}
\newcounter{linepages}
\newlength\linesep
\newlength\linesepaux
\newlength\mylinewidth
\setlength\linesep{40pt}
\colorlet{mycolor}{cyan!60!black}
\setlength\mylinewidth{6pt}
\setlength\linesepaux{\linesep}
\newcommand\tikzmark[1]{%
\tikz[remember picture,overlay] \coordinate (#1) {};}
\titleformat{\section}
{\normalfont\Large\bfseries}
{\thesection}
{1em}
{\begin{tikzpicture}[remember picture,overlay]
\draw[line width=\mylinewidth,mycolor] ([xshift=\the\dimexpr\linesepaux+0.5\mylinewidth\relax]current page text area.east|-s-\the\numexpr\thesection-1\relax) --
([xshift=\the\dimexpr-\linesepaux-0.5\mylinewidth\relax]current page text area.west|-s-\the\numexpr\thesection-1\relax);
\end{tikzpicture}%
}
\newcommand\StartSecLine{%
\stepcounter{seccount}
\ifthenelse{\isodd{\theseccount}}
{\global\renewcommand\pos{current page text area.north west}%
\global\setlength\linesep{\linesepaux}}
{\global\renewcommand\pos{current page text area.north east}%
\global\setlength\linesep{-\linesepaux}}
\tikzmark{e-\theseccount}\label{e-\theseccount}%
\ifnum
\getpagerefnumber{e-\theseccount}=\getpagerefnumber{s-\theseccount}\relax
\else
\begin{tikzpicture}[overlay, remember picture]
\draw [line width=\mylinewidth,mycolor]
([xshift=-\linesep]\pos|-e-\theseccount) -- ([xshift=-\linesep]\pos|-current page text area.south);
\end{tikzpicture}
\setcounter{linepages}{\numexpr\getpagerefnumber{s-\theseccount}-\getpagerefnumber{e-\theseccount}}
\ifnum\value{linepages}>1
\AtBeginShipoutNext{\tikzlinepage}%
\fi%
\fi%
}
\newcommand\EndSecLine{%
\tikzmark{s-\theseccount}\label{s-\theseccount}
\ifnum
\getpagerefnumber{s-\theseccount}=\getpagerefnumber{e-\theseccount}\relax
\begin{tikzpicture}[overlay, remember picture]
\draw [line width=\mylinewidth,mycolor]
([xshift=-\linesep]\pos|-e-\theseccount) -- ([xshift=-\linesep]\pos|-s-\theseccount);
\end{tikzpicture}%
\else
\begin{tikzpicture}[overlay, remember picture]
\draw [line width=\mylinewidth,mycolor]
([xshift=-\linesep]\pos) -- ([xshift=-\linesep]\pos|-s-\theseccount);
\end{tikzpicture}%
\fi
}
\newcommand\Initrules{%
\begin{tikzpicture}[remember picture,overlay]
\draw[line width=\mylinewidth,mycolor]
([xshift=\the\dimexpr\linesep\relax]current page text area.east|-e-1) --
([xshift=\linesep,yshift=-20pt]current page text area.east|-current page.north);
\draw[line width=\mylinewidth,mycolor]
([xshift=\the\dimexpr\linesep+0.5\mylinewidth\relax]current page text area.east|-e-1) --
([xshift=\the\dimexpr-\linesep-0.5\mylinewidth\relax]current page text area.west|-e-1);
\end{tikzpicture}%
}
\newcommand\tikzlinepage{%
\begin{tikzpicture}[overlay, remember picture]
\draw [line width=\mylinewidth,mycolor]
([xshift=-\linesep]\pos) --
([xshift=-\linesep]\pos|-current page text area.south west);
\end{tikzpicture}
\addtocounter{linepages}{-1}%
\ifnum\value{linepages}>1
\AtBeginShipoutNext{\tikzlinepage}%
\fi%
}
\AtBeginDocument{%
\noindent\tikzmark{s-0}
\StartSecLine
\Initrules}
\AtEndDocument{%
\EndSecLine}
\newcommand\StartMarks{\pretocmd{\section}{\EndSecLine\StartSecLine}{}{}}
\begin{document}
\section{Test Section One}
\lipsum[1-2]
\StartMarks
\section{Test Section Two}
\lipsum[1-8]
\section{Test Section Three}
\lipsum[4]
\section{Test Section Four}
\lipsum[1]
\section{Test Section Five}
\lipsum[4-5]
\section{Test Section Six}
\lipsum[4-6]
\end{document}
Changing the values for mycolor, \mylinewidth and \linesep, the color, width and separation between the rule and the text can be easily customized.
